Skip to content

[Bug] Constant Editor Crashing on Using Firebase #1199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Moe-Baker opened this issue Mar 5, 2025 · 12 comments
Open

[Bug] Constant Editor Crashing on Using Firebase #1199

Moe-Baker opened this issue Mar 5, 2025 · 12 comments

Comments

@Moe-Baker
Copy link

Description

For the past 4 months our project has been plagued by constant Unity editor crashes.
After opening the project, the first play mode launch works fine, but the possibility of crashing starts racking up after that. It used to crash after every 5-6 play modes, now it crashes after about 2-3, and sometimes while just compiling code.

Reproducing the issue

No response

Firebase Unity SDK Version

12.6.0

Unity editor version

6.0000.0.40f1

Installation Method

Unity Package Manager

Problematic Firebase Component(s)

Firestore, Functions, Messaging, Database, Authentication

Other Firebase Component(s) in use

No response

Additional SDKs you are using

GameAnalytics, Adjust, Unity Services (Cloud Content Delivery, In App Purchasing, Vivox)

Targeted Platform(s)

Desktop

Unity editor platform

Windows

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

Relevant Log Output

https://pastebin.com/7wdGJGgv

If using CocoaPods for Apple platforms, the project's Podfile.lock

No response

@Moe-Baker Moe-Baker added new New issue. type: bug labels Mar 5, 2025
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@argzdev
Copy link

argzdev commented Mar 5, 2025

Hey @Moe-Baker, thanks for reaching out. For runtime crashes, I'm guessing that the instantiation of multiple SDKs using async/await could potentially introduce race conditions if ever any call to its functions is made before finishing initialization. As for compilation crashes, this is very rare, and could mean a bug within our SDK or an issue with the integration setup.

That said, are you able to reproduce the same behavior with an MCVE? If so, any chance you could share this with us? It'll help us investigate this issue further.

@argzdev argzdev added the needs-info Need information for the developer label Mar 5, 2025
@Moe-Baker
Copy link
Author

I can't really validate it with a minimal project; it's a very random crash.
I'll investigate the async SDK usage.

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Mar 6, 2025
@TeorikDeli
Copy link

TeorikDeli commented Mar 25, 2025

This crashes usually happening when we disable domain reloading while entering play mode and making C# script changes while in play mode. FirebaseStorage.OnAppDisposed() is the reason I believe (I think it is triggered from Firebase.FirebaseApp:Finalize() -> Firebase.FirebaseApp:Dispose (bool)). All crash logs points to this. I had many crash logs when I created a bug report to Unity, but after the report I deleted them all. And Unity said "this is a third party issue".

Edit: This is happening Windows 11, 10 and macOS (both Intel & Apple Silicon). Unity 21 LTS and Unity 6

@argzdev argzdev added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels May 13, 2025
@google-oss-bot google-oss-bot added the stale Don't have recent activity label May 14, 2025
@google-oss-bot
Copy link

Hey @Moe-Baker. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@TeorikDeli
Copy link

TeorikDeli commented May 14, 2025

Obtained 54 stack frames.
#0 0x0000024b8344a0 in (Unknown)
#1 0x000003c47db37d in firebase::callback::CallbackValue1::Run()
#2 0x000003c47402e9 in firebase::callback::CallbackEntry::Execute()
#3 0x000003c473df7d in firebase::callback::CallbackDispatcher::DispatchCallbacks()
#4 0x000003c473dec1 in firebase::callback::PollCallbacks()
#5 0x000003c47c7f29 in Firebase_App_CSharp_PollCallbacks
#6 0x00000245a04a37 in (wrapper managed-to-native) Firebase.AppUtilPINVOKE:PollCallbacks () [{0x7f89d58786b0} + 0xa7] (0x245a04990 0x245a04ae4) [0x175383a80 - Unity Child Domain]
#7 0x0000018742695e in mono_jit_runtime_invoke
#8 0x000001875daadc in do_runtime_invoke
#9 0x000001875daa40 in mono_runtime_invoke
#10 0x00000102e4b087 in scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)
#11 0x00000102e20d68 in ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)
#12 0x00000102de1f61 in MonoBehaviour::CallMethodIfAvailable(int)
#13 0x00000102de1e0a in MonoBehaviour::CallUpdateMethod(int)
#14 0x0000010274167c in void BaseBehaviourManager::CommonUpdate()
#15 0x0000010274145d in BehaviourManager::Update()
#16 0x00000102a2c5b0 in InitPlayerLoopCallbacks()::UpdateScriptRunBehaviourUpdateRegistrator::Forward()
#17 0x000001029e8b10 in ExecutePlayerLoop(NativePlayerLoopSystem*)
#18 0x000001029e8b51 in ExecutePlayerLoop(NativePlayerLoopSystem*)
#19 0x000001029e8fbc in PlayerLoop()
#20 0x00000103c24303 in EditorPlayerLoop::Execute()
#21 0x00000103c27c92 in PlayerLoopController::InternalUpdateScene(bool, bool)
#22 0x00000103c28916 in PlayerLoopController::EnterPlayMode()
#23 0x00000103c27013 in PlayerLoopController::SetIsPlaying(bool)
#24 0x00000103c19d2e in Application::TickTimer()
#25 0x000001051c27dc in -[EditorApplication onEditorUpdatesTickTimer]
#26 0x007ff811c5f70f in __NSFireTimer
#27 0x007ff810bc663d in CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION
#28 0x007ff810bc6228 in __CFRunLoopDoTimer
#29 0x007ff810bc5e46 in __CFRunLoopDoTimers
#30 0x007ff810badbc4 in __CFRunLoopRun
#31 0x007ff810baccb2 in CFRunLoopRunSpecific
#32 0x007ff81c5c90d4 in RunCurrentEventLoopInMode
#33 0x007ff81c5cbe60 in ReceiveNextEventCommon
#34 0x007ff81c75519a in _BlockUntilNextEventMatchingListInModeWithFilter
#35 0x007ff81455ee39 in _DPSNextEvent
#36 0x007ff814fec997 in -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
#37 0x000001051c27a2 in -[EditorApplication onEditorUpdatesTickTimer]
#38 0x007ff811c5f70f in __NSFireTimer
#39 0x007ff810bc663d in CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION
#40 0x007ff810bc6228 in __CFRunLoopDoTimer
#41 0x007ff810bc5e46 in __CFRunLoopDoTimers
#42 0x007ff810badbc4 in __CFRunLoopRun
#43 0x007ff810baccb2 in CFRunLoopRunSpecific
#44 0x007ff81c5c90d4 in RunCurrentEventLoopInMode
#45 0x007ff81c5cbe60 in ReceiveNextEventCommon
#46 0x007ff81c75519a in _BlockUntilNextEventMatchingListInModeWithFilter
#47 0x007ff81455ee39 in _DPSNextEvent
#48 0x007ff814fec997 in -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
#49 0x007ff81454ff19 in -[NSApplication run]
#50 0x007ff814523085 in NSApplicationMain
#51 0x000001051d959b in EditorMain(int, char const**)
#52 0x000001051d98b9 in main
#53 0x007ff810721530 in start
Launching bug reporter
2025-05-14 12:43:50.370 UnityBugReporter[24685:6496929] apply_selection_policy_once: prefer use of removable GPUs (via com.unity3d.bugreporter:GPUSelectionPolicy->preferRemovable)
Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created.
12:43:51.415 |E| --LOGLOG-- | WatchParentPid:81850:4 | System.Exception: Parent process PID:81850 has quit, killing ourselves via Process.Kill

Parent process PID:81850 has quit, killing ourselves via Process.Kill

--- EXCEPTION #1/1 [LoggerException]
Message = “Parent process PID:81850 has quit, killing ourselves via Process.Kill”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
at JetBrains.Util.LoggerBase.Log(LoggingLevel level, String message, Exception ex)
at JetBrains.Diagnostics.ProcessWatchdog.<>c__DisplayClass6_0.b__0()
at System.Threading.Thread.StartCallback()

�[40m�[32minfo�[39m�[22m�[49m: Microsoft.Hosting.Lifetime[0]
Application is shutting down...
�[40m�[32minfo�[39m�[22m�[49m: Unity.ILPP.Runner.PostProcessingAssemblyLoadContext[0]
ALC ILPP context 2 is unloading

this is the log for me.

@google-oss-bot google-oss-bot added stale Don't have recent activity and removed stale Don't have recent activity labels May 14, 2025
@google-oss-bot
Copy link

Hey @Moe-Baker. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@TeorikDeli
Copy link

@google-oss-bot really? @argzdev ?

@google-oss-bot google-oss-bot removed the stale Don't have recent activity label May 22, 2025
@argzdev argzdev removed the needs-info Need information for the developer label May 22, 2025
@argzdev
Copy link

argzdev commented May 22, 2025

Hey @TeorikDeli, thanks for giving this thread some updates. I haven't had the time to look into this deeper, but looking through the details you've provided, you mentioned that the issue is triggered from Firebase Storage. I don't see any Firebase Storage from the initial report of @Moe-Baker. I'm not sure if this is the same issue.

I'm wondering if there's any extra steps to reproduce the behavior. Any chance you could provide steps or MCVE for us to reproduce the behavior?

@TeorikDeli
Copy link

TeorikDeli commented May 22, 2025

Hi @argzdev . This is really random; mostly it happens, but not always. "This crashes usually happening when we disable domain reloading while entering play mode and making C# script changes while in play mode." is the most possible reason for this crash to happen (at least for us). If we're using multiple instance (with ParrelSync for example), the problem occurs much frequently). I added the other crash log, because it gave different stack trace that time. But all crashes has a "Firebase" log in the last step. Either it is FireStore, or FirebaseApp, etc.

I think the crash rate is higher on Windows; but I am not sure about this. I am on macOS (my main device is intel, but I have an M4 mac mini, which has the same crash problem); my colleagues are on Windows.

We're also using these lines for Editor:

FirebaseDatabase.DefaultInstance.SetPersistenceEnabled(false);
FirebaseStorage.DefaultInstance.LogLevel = LogLevel.Assert;
if(ClonesManager.IsClone())
    FirebaseFirestore.DefaultInstance.Settings.PersistenceEnabled = false;

These lines helped to minimize crash rate, especially while using ParrelSync clones; but still happening.

@argzdev
Copy link

argzdev commented May 22, 2025

Thanks @TeorikDeli, these information are helpful. I'll keep an eye out and test these out once after sometime. I'll update back here once I have more information to share.

@TeorikDeli
Copy link

TeorikDeli commented May 23, 2025

This is another log from another crash. This happened after ~15 mins I built for iOS. I tried to press Play button in the Editor.

Listen at Users/Macbook failed: This client does not have permission to perform this operation.
UnityEngine.Debug:ExtractStackTraceNoAlloc (byte*,int,string)
UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)
UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:LogWarning (object)
Firebase.Platform.FirebaseLogger:LogMessage (Firebase.Platform.PlatformLogLevel,string) (at /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/Unity/FirebaseLogger.cs:92)
Firebase.LogUtil:LogMessage (Firebase.LogLevel,string) (at /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:69)
Firebase.LogUtil:LogMessageFromCallback (Firebase.LogLevel,string) (at /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:77)
Firebase.AppUtil:PollCallbacks () (at /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/linux_unity/app/swig/Firebase.App_fixed.cs:4656)
Firebase.Platform.FirebaseAppUtils:PollCallbacks () (at /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/FirebaseAppUtils.cs:33)
Firebase.Platform.FirebaseHandler:Update () (at /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/Unity/FirebaseHandler.cs:208)
Firebase.Platform.FirebaseMonoBehaviour:Update () (at /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/Unity/FirebaseMonoBehaviour.cs:45)

(Filename: /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs Line: 69)

Obtained 42 stack frames.
#0  0x00000288ee6580 in (Unknown)
#1  0x000002c37d8cbc in firebase::callback::CallbackValue2String1<int, firebase::database::Error>::Run()
#2  0x000002c355e2e9 in firebase::callback::CallbackEntry::Execute()
#3  0x000002c355bf7d in firebase::callback::CallbackDispatcher::DispatchCallbacks()
#4  0x000002c355bec1 in firebase::callback::PollCallbacks()
#5  0x000002c35e5f29 in Firebase_App_CSharp_PollCallbacks
#6  0x0000027d727a07 in  (wrapper managed-to-native) Firebase.AppUtilPINVOKE:PollCallbacks () [{0x7fb1e7bbe058} + 0x57]  (0x27d7279b0 0x27d727a85) [0x19d5c4a80 - Unity Child Domain]
#7  0x0000019d9e89be in mono_jit_runtime_invoke
#8  0x0000019db9cad4 in do_runtime_invoke
#9  0x0000019db9ca38 in mono_runtime_invoke
#10 0x00000108abb777 in scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)
#11 0x00000108a90cf8 in ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)
#12 0x00000108a50ba1 in MonoBehaviour::CallMethodIfAvailable(int)
#13 0x00000108a50a4a in MonoBehaviour::CallUpdateMethod(int)
#14 0x00000108391c0c in void BaseBehaviourManager::CommonUpdate<BehaviourManager>()
#15 0x000001083919ed in BehaviourManager::Update()
#16 0x0000010868e640 in InitPlayerLoopCallbacks()::UpdateScriptRunBehaviourUpdateRegistrator::Forward()
#17 0x0000010864a570 in ExecutePlayerLoop(NativePlayerLoopSystem*)
#18 0x0000010864a5b1 in ExecutePlayerLoop(NativePlayerLoopSystem*)
#19 0x0000010864aa1c in PlayerLoop()
#20 0x000001098f37c3 in EditorPlayerLoop::Execute()
#21 0x000001098f86f2 in PlayerLoopController::InternalUpdateScene(bool, bool)
#22 0x000001098f9376 in PlayerLoopController::EnterPlayMode()
#23 0x000001098f7a73 in PlayerLoopController::SetIsPlaying(bool)
#24 0x000001098e916e in Application::TickTimer()
#25 0x0000010af08b7c in -[EditorApplication onEditorUpdatesTickTimer]
#26 0x007ff811c5f70f in __NSFireTimer
#27 0x007ff810bc663d in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
#28 0x007ff810bc6228 in __CFRunLoopDoTimer
#29 0x007ff810bc5e46 in __CFRunLoopDoTimers
#30 0x007ff810badbc4 in __CFRunLoopRun
#31 0x007ff810baccb2 in CFRunLoopRunSpecific
#32 0x007ff81c5c90d4 in RunCurrentEventLoopInMode
#33 0x007ff81c5cbe60 in ReceiveNextEventCommon
#34 0x007ff81c75519a in _BlockUntilNextEventMatchingListInModeWithFilter
#35 0x007ff81455ee39 in _DPSNextEvent
#36 0x007ff814fec997 in -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
#37 0x007ff81454ff19 in -[NSApplication run]
#38 0x007ff814523085 in NSApplicationMain
#39 0x0000010af1f90b in EditorMain(int, char const**)
#40 0x0000010af1fc29 in main
#41 0x007ff810721530 in start
Launching bug reporter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants