firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
231 stars 38 forks source link

[Bug] Crash on Quit when using Analytics, Crashlytics, and Remote Config #570

Open a-maurice opened 1 year ago

a-maurice commented 1 year ago

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

Steps to reproduce:

One of the issues flagged in https://github.com/firebase/quickstart-unity/issues/1193#issuecomment-1036330576. It seems like there is a problem when the application is shutting down that can result in a crash. There are a variety of users with different reports, but nothing concrete on reproduction steps, but the most relevant apis are Analytics, Crashlytics, and possibly Remote Config (though it isn't always included).

A possible way to reproduce the problem is adding a call to Unity's Application.Quit(), and watching the logs to see if anything odd appears.

shefich commented 1 year ago

@a-maurice which call or logs should be added?

Meanwhile I can see such errors OnApplicationQuit after almost everything destroyed: For Unity 2021: `Crashed: Thread #1 SIGSEGV 0x000000000000013a 0 libunity.so JobQueue::WaitForJobGroupID(JobGroupID, JobQueue::JobQueueWorkStealMode)

1 libunity.so ashldi3 2 libunity.so ashldi3 3 libunity.so CompleteFenceInternal(JobFence&, WorkStealMode) 4 libunity.so AsyncUploadManager::~AsyncUploadManager() 5 libunity.so ashldi3 6 libunity.so AsyncUploadManager::StaticDestroy(void) 7 libunity.so RegisterRuntimeInitializeAndCleanup::ExecuteCleanup() 8 libunity.so UnityTimeToUnixTime(DateTime const&, long&) 9 libc.so (Missing UUID 98d22ed69dca1afbfed9c2da3b49ce91) 10 libunity.so RuntimeCleanup() 11 libunity.so operator delete(void) 12 libunity.so unwindstack::MapInfo::~MapInfo() 13 libunity.so ashldi3 14 libunity.so unwindstack::Maps::Clear() 15 libunity.so UnityFinalDeinitApplication() 16 libunity.so nativeDone(_JNIEnv, _jobject) 17 (Missing) 29 (Missing) 30 libunity.so __ashldi3 31 (Missing) 63 libart.so (Missing UUID b5fc7fc369f2cabea0a1e9a49518ab60)`

For Unity 2020 and earlier: `Crashed: Thread #1

SIGSEGV 0x0000000000000154

0 libunity.so nativeDone(_JNIEnv, _jobject)

1 libunity.so nativeDone(_JNIEnv, _jobject)

2 (Missing)`

a-maurice commented 1 year ago

@shefich One potential setting that might help is adding:

Firebase.FirebaseApp.LogLevel = Firebase.LogLevel.Debug;

which will make the logs include more debug information. Though I suspect part of the fix will require deeper debugging, which is why we haven't been able to identify the root cause yet.

shefich commented 1 year ago

Hi @a-maurice, "Firebase.LogLevel.Debug" doesn't helps to have more logs. Many errors connected too the "libmonochrome.so". Here's stacktrace with other thread/library: issue_b0331e86d965953967fab1ff4abe0d07_crash_session_63a91b24017c00015e2f1c6078cf81de_DNE_0_v2_stacktrace (1).txt

Tell me please, if it helps.