firebase-unity-sdk icon indicating copy to clipboard operation
firebase-unity-sdk copied to clipboard

Editor sometimes crashes after disposing Firebase App

Open dex3r opened this issue 4 years ago • 5 comments

Sometimes after disposing FirebaseApp the editor crashes.

error.log from Unity crash reporter: https://gist.github.com/dex3r/58d07f70dce8c90ac167628350182729

Last managed log from Unity:

FirebaseRemoteConfig.OnAppDisposed()
0x00007ff609cc0fbc (Unity) StackWalker::GetCurrentCallstack
0x00007ff609cc9399 (Unity) StackWalker::ShowCallstack
0x00007ff60b1e4f8c (Unity) GetStacktrace
0x00007ff60c310b13 (Unity) DebugStringToFile
0x00007ff609d3c736 (Unity) DebugLogHandler_CUSTOM_Internal_Log
0x00000252542518cb (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
0x000002525425174b (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
0x0000025254250bce (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object)
0x00000251fae60bcd (Mono JIT Code) UnityEngine.Debug:LogWarning (object)
0x00000251f184527b (Mono JIT Code) [FirebaseLogger.cs:93] Firebase.Platform.FirebaseLogger:LogMessage (Firebase.Platform.PlatformLogLevel,string) 
0x00000251f1844e73 (Mono JIT Code) [LogUtil.cs:69] Firebase.LogUtil:LogMessage (Firebase.LogLevel,string) 
0x00000251fae60a73 (Mono JIT Code) [FirebaseRemoteConfig.cs:82] Firebase.RemoteConfig.FirebaseRemoteConfig:OnAppDisposed (object,System.EventArgs) 
0x00000251fae60925 (Mono JIT Code) (wrapper delegate-invoke) <Module>:invoke_void_object_EventArgs (object,System.EventArgs)
0x00000251f1e13ea4 (Mono JIT Code) [FirebaseApp.cs:58] Firebase.FirebaseApp:Dispose () 
0x00000251fa78f373 (Mono JIT Code) [FirebaseWrapper.cs:300] Mati.Core.Firebase.FirebaseWrapper:Dispose () 
0x00000251fae5effe (Mono JIT Code) [DisposableManager.cs:122] Zenject.DisposableManager:Dispose () 
0x00000251fae5e1b3 (Mono JIT Code) [GameAppController.cs:100] PVP_Puzzle.CompositionRoot.GameAppController:DisposeDisposables () 
0x00000251fae5df3b (Mono JIT Code) [GameAppController.cs:90] PVP_Puzzle.CompositionRoot.GameAppController:End () 
0x00000251fae5dd33 (Mono JIT Code) [GameAppController.cs:124] PVP_Puzzle.CompositionRoot.GameAppController:Dispose () 
0x00000251fae5dc23 (Mono JIT Code) [PvpPuzzleEntryPoint.cs:71] PVP_Puzzle.Kernel.PvpPuzzleEntryPoint:OnApplicationQuit () 
0x00000252542dcb68 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007ff9da81e660 (mono-2.0-bdwgc) [mini-runtime.c:2816] mono_jit_runtime_invoke 
0x00007ff9da7a2ae2 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke 
0x00007ff9da7abb3f (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke 
0x00007ff609b488f4 (Unity) scripting_method_invoke
0x00007ff609b41245 (Unity) ScriptingInvocation::Invoke
0x00007ff609af2e9b (Unity) MonoBehaviour::HandleNotifications
0x00007ff608cbe680 (Unity) GameObject::SendMessageAny
0x00007ff6093f2952 (Unity) SendMessageToEveryone
0x00007ff609432356 (Unity) NotifyPlayerQuit
0x00007ff60a8423a2 (Unity) PlayerLoopController::ExitPlayMode
0x00007ff60a857747 (Unity) PlayerLoopController::SetIsPlaying
0x00007ff60a85a4a4 (Unity) Application::TickTimer
0x00007ff60b1ee781 (Unity) MainMessageLoop
0x00007ff60b1f27c1 (Unity) WinMain
0x00007ff60d0434b6 (Unity) __scrt_common_main_seh
0x00007ffa7e617034 (KERNEL32) BaseThreadInitThunk
0x00007ffa7eaa2651 (ntdll) RtlUserThreadStart

Crash Stack Trace:

0x00007FF9BCE0BA85 (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCEECCDE (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCEFBC2A (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCEF54BF (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCEF4D80 (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCE6D06D (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCE6BBB0 (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCE0D256 (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCDAF228 (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BD2035BD (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FFA7E617034 (KERNEL32) BaseThreadInitThunk
0x00007FFA7EAA2651 (ntdll) RtlUserThreadStart

dex3r avatar Dec 09 '21 12:12 dex3r

If you're using the FB database add this:

#if UNITY_EDITOR
            Db.SetPersistenceEnabled(false); // Prevent editor crash https://stackoverflow.com/questions/45782602/
#endif

It's possibly related (was in my case where I ran multiple editors at a time)

Also out of curiosity, which platform is your editor running on?

dginovker avatar Jan 14 '22 15:01 dginovker

Hi,

I had this error too and fixed it by no longer disposing of the app during shutdown. It seems to work fine.

cjcurrie avatar Feb 24 '22 22:02 cjcurrie

Sorry for replying this late.

@dex3r

From your log, seem like you were using Firebase 8.3.0 in Unity 2020.3.16f1.

  • Does this still occurs when you upgrade to later version of Unity?
  • Does this occurs only in the editor?
  • Could you show us snippet of code where you dispose FirebaeApp? Does it work if you just don't dispose FirebaseApp?

I think the real suspicious callstack is this one.

Call Stack for Thread 26800:
0x00007FFA7EAECDF4 (ntdll) NtWaitForSingleObject
0x00007FFA7C651A5E (KERNELBASE) WaitForSingleObjectEx
0x00007FF9BCE0D814 (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCE0B491 (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCE4256A (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCDD0716 (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCD94BBF (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCDD0C01 (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCDD0B52 (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_StorageInternal
0x00007FF9BCD76F70 (FirebaseCppApp-8_3_0) SWIGRegisterStringCallback_FirestoreCpp
0x00000251FAE62174 (Mono JIT Code) <unknown class>.<unknown method>()
0x00000251FAE61F63 (Mono JIT Code) <unknown class>.<unknown method>()
0x00000251FAE61CEB (Mono JIT Code) <unknown class>.<unknown method>()
0x00000251FAE61A01 (Mono JIT Code) <unknown class>.<unknown method>()
0x00000251FAE617AB (Mono JIT Code) <unknown class>.<unknown method>()
0x00000251FAE60925 (Mono JIT Code) <unknown class>.<unknown method>()
0x00000251F1E13EA4 (Mono JIT Code) <unknown class>.<unknown method>()
0x00000251FA78F373 (Mono JIT Code) <unknown class>.<unknown method>()
0x00000251FAE5EFFE (Mono JIT Code) <unknown class>.<unknown method>()
0x00000251FAE5E1B3 (Mono JIT Code) <unknown class>.<unknown method>()
0x00000251FAE5DF3B (Mono JIT Code) <unknown class>.<unknown method>()
0x00000251FAE5DD33 (Mono JIT Code) <unknown class>.<unknown method>()
0x00000251FAE5DC23 (Mono JIT Code) <unknown class>.<unknown method>()
0x00000252542DCB68 (Mono JIT Code) <unknown class>.<unknown method>()
0x00007FF9DA81E660 (mono-2.0-bdwgc) mono_get_runtime_build_info
0x00007FF9DA7A2AE2 (mono-2.0-bdwgc) mono_perfcounters_init
0x00007FF9DA7ABB3F (mono-2.0-bdwgc) mono_runtime_invoke
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF609B488F4)
0x00007FF609B488F4 (Unity) (function-name not available)

This might be fixed overtime.

Please let us know.

chkuang-g avatar Oct 10 '22 03:10 chkuang-g

Hey @dex3r. 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!

google-oss-bot avatar Oct 17 '22 01:10 google-oss-bot

@chkuang-g It's been almost a year since I've reported this :) I'm going to copy-paste my response from another issue:

Unfortunately, due to a number of bugs and other problems I've encountered during further development I had to move out of Firebase.

One thing I can recommend to the Firebase team is to move Unity SDK natively to C#. Trying to fix issues with C++ SDK with a cumbersome Swig layer on top is an absolute nightmare.

dex3r avatar Oct 17 '22 10:10 dex3r

Hi @dex3r,

I'm sorry to hear that you've moved on. I'm going to close this issue for now since there doesn't seem to be any more information coming from any of the participants. If someone has more information about this issue then please create a new ticket and link this one to it.

Thanks!

DellaBitta avatar Nov 09 '22 02:11 DellaBitta