[Bug] Unity crashes often when entering play mode due to the Firebase SDK
See original GitHub issue[REQUIRED] Please fill in the following fields:
- Unity editor version: 2021.3.23f1
- Firebase Unity SDK version: 10.6.0
- Source you installed the SDK: Unity Package
- Problematic Firebase Component: FirebaseCppApp
- Other Firebase Components in use: Auth, Analytics, Functions, Crashalytics, RemoteConfig
- Additional SDKs you are using: IronSource and a bunch of assets from the Asset Store (but the crash is very clearly due to Firebase)
- Platform you are using the Unity editor on: Windows & Mac
- Platform you are targeting: iOS & Android
- Scripting Runtime: IL2CPP
- Pre-built SDK from the website or open-source from this repo: Website
[REQUIRED] Please describe the issue here:
Frequently when I make a change in my code and go back to Unity it starts the recompile but then fully crashes and has to restart the editor. The editor logs clearly show an issue related to FirebaseCppApp not being able to release an internal reference to the functions library.
Steps to reproduce:
It’s unclear what the real trigger is, it happens on macOS and Windows, targeting iOS and Android and it doesn’t matter whether the game was already in play mode or not. I simply change some code in Rider, switch back to Unity and it crashes. The crash happens roughly 5% of the time but it’s very disruptive to my workflow.
Crash log:
========== OUTPUTTING STACK TRACE ==================
0x00007FFD36264A06 (FirebaseCppApp-10_6_0) uWS::HttpSocket<0>::upgrade
0x00007FFD3624CF5B (FirebaseCppApp-10_6_0) uWS::HttpSocket<0>::upgrade
0x00007FFD3624E663 (FirebaseCppApp-10_6_0) uWS::HttpSocket<0>::upgrade
0x00007FFD3623FD78 (FirebaseCppApp-10_6_0) uWS::HttpSocket<0>::upgrade
0x00007FFD36206A14 (FirebaseCppApp-10_6_0) uWS::HttpSocket<0>::upgrade
0x00007FFD362045D1 (FirebaseCppApp-10_6_0) uWS::HttpSocket<0>::upgrade
0x00007FFD35D20BCB (FirebaseCppApp-10_6_0) uWS::WebSocket<0>::send
0x00007FFD35D1FC1C (FirebaseCppApp-10_6_0) uWS::WebSocket<0>::send
0x00007FFD35C4423D (FirebaseCppApp-10_6_0) uS::Socket::freeMessage
0x00007FFD35D1FEB0 (FirebaseCppApp-10_6_0) uWS::WebSocket<0>::send
0x00007FFD35D1FE29 (FirebaseCppApp-10_6_0) uWS::WebSocket<0>::send
0x00007FFD35C1F390 (FirebaseCppApp-10_6_0) SWIGRegisterStringCallback_FirestoreCpp
0x000001EC9904E1BC (Mono JIT Code) (wrapper managed-to-native) Firebase.Functions.FunctionsInternalPINVOKE:FirebaseFunctionsInternal_ReleaseReferenceInternal (System.Runtime.InteropServices.HandleRef)
0x000001EC9904DF2B (Mono JIT Code) Firebase.Functions.FirebaseFunctionsInternal:ReleaseReferenceInternal (Firebase.Functions.FirebaseFunctionsInternal)
0x000001EC9904DBAB (Mono JIT Code) Firebase.Functions.FirebaseFunctionsInternal:Dispose (bool)
0x000001EC9904D964 (Mono JIT Code) Firebase.Functions.FirebaseFunctionsInternal:Dispose ()
0x000001EC9904D5AB (Mono JIT Code) Firebase.Functions.FirebaseFunctions:Dispose ()
0x000001EC9904D173 (Mono JIT Code) Firebase.Functions.FirebaseFunctions:Finalize ()
0x000001EBE7FDF02C (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr)
0x00007FFD56310BA5 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\gc.c:383] mono_gc_run_finalize
0x00007FFD56311C5E (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\gc.c:944] finalize_domain_objects
0x00007FFD563121D3 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\gc.c:1036] finalizer_thread
0x00007FFD562AD2DB (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\threads.c:1268] start_wrapper_internal
0x00007FFD562AD4B6 (mono-2.0-bdwgc) [C:\build\output\Unity-Technologies\mono\mono\metadata\threads.c:1344] start_wrapper
0x00007FFE0DBC7614 (KERNEL32) BaseThreadInitThunk
0x00007FFE0EAE26A1 (ntdll) RtlUserThreadStart
========== END OF STACKTRACE ===========
Issue Analytics
- State:
- Created 4 months ago
- Reactions:1
- Comments:40 (6 by maintainers)
Top Results From Across the Web
Unity crashes after entering play mode a couple of times
The problem is that unity does not crash it freezes so whe do not get any crash report. And when it freezes we...
Read more >Understand a Unity game's crashes using advanced ...
Test crashing your game at the touch of a button in CrashNow() After Crashlytics is set up in your game, the Crashlytics SDK...
Read more >Unity app crashes with Firebase SDK
I added the Firebase SDK to my Unity game. Unity compiles fine but when I start the game on my Android device it...
Read more >Editor freezes when entering Play mode and Firebase ...
Maybe this error happens because unity tries to set the reference to the variable in the first frame, without having the reference information....
Read more >Unity keeps crashing on play. Ctrl-Alt-Del doesnt work. One at at
Go to the Compatibility tab, and select Run this program as administrator. Hit enter playmode, then unity crash. in module KERNELBASE. Sometimes the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@KSF000 Interesting, but I don’t think that’s my issue here, all my libraries have the same version (whenever I upgrade them I make sure to upgrade all of them to avoid any conflicts, takes a lot longer to do but eventually they’d need to be updated anyways so I just do it in one go)
Hi all,
We identified one potential crash that folks could’ve been running into, within Auth’s FirebaseUser, that has been fixed with 11.4.0. I know multiple of these callstacks don’t mention Auth though, so it likely won’t address everyone’s problem, and I am still investigating these other ones.
The biggest thing that would help are logs with debug logging enabled, and code samples that can reliably reproduce the problem. We automate test runs nightly, and run tests in Unity ourselves regularly, but a lot of the edge cases, especially around when the Unity editor recompiles code while the game is running, are really hard to reliably test around.