firebase / firebase-unity-sdk

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

[Bug] Firebase_App_CSharp_PollCallbacks is broken #818

Open GabrielJadderson opened 1 year ago

GabrielJadderson commented 1 year ago

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the issue here:

Unity crashes randomly while compiling scripts. Happens very very often atleast once an hour.

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? 100%

What happened? How can we make the problem occur? just write some code and wait for unity to compile then it will crash randomly.

If you have a downloadable sample project that reproduces the bug you're reporting, you will likely receive a faster response on your issue.

Relevant Code:

Stacktrace of the error, It's always the same stacktrace.

image

These are the dependencies I am using: image

The error happens in this dll "FirebaseCppApp-11_2_0" the entrypoint is in this function "Firebase_App_CSharp_PollCallbacks"

This is a crash minidump: crash.zip

This is how frequent the crashes are (the gap is when I went on vacation): image

google-oss-bot commented 1 year ago

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

paulinon commented 1 year ago

Hi @GabrielJadderson,

Thanks for reproting this. I noticed that you're using version 11.2.0 of the Firebase Unity SDK. This makes use of version 1.2.176 of the External Dependency Manager. Could you try that version of the External Dependency Manager and see if the issue persists?

GabrielJadderson commented 1 year ago

Hi, I updated the External Dependency Manager on Friday to 1.2.176 from 1.2.175 and got a crash today again.

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) Firebase.AppUtilPINVOKE.PollCallbacks () [0x00008] in <2666a65f602a40e38c3d9e96ff6859c1>:0
  at Firebase.AppUtil.PollCallbacks () [0x00001] in /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/android_unity/armeabi-v7a/app/swig/Firebase.App_fixed.cs:4785
  at Firebase.Platform.FirebaseAppUtils.PollCallbacks () [0x00001] in /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/FirebaseAppUtils.cs:33
  at Firebase.Platform.FirebaseHandler.Update () [0x0000c] in /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/Unity/FirebaseHandler.cs:208
  at Firebase.Platform.FirebaseMonoBehaviour.Update () [0x0001c] in /Users/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/platform/Unity/FirebaseMonoBehaviour.cs:45
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) [0x00020] in <695d1cc93cca45069c528c15c9fdd749>:0

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Received signal SIGSEGV
Stack trace:
RtlLookupFunctionEntry returned NULL function. Aborting stack walk.
<Missing stacktrace information>

crash.zip

chriswalz commented 1 year ago

@GabrielJadderson This happens to me all the time as well. They haven't fixed it for at least a year. It's absurd considering how much they get paid. I recommend turning off all firebase related game objects when in the editor. That worked for me (while not working on firebase related development). Wish they would fix the problem or at a minimum improve the debugging logs. I don't think they have any clue what the problem is and I'm not entirely convinced they care. Hopefully Supabase comes with official Unity support one day. At this rate Google is gonna kill this product any day now.

Related issues with no resolution or concern to actually fix:

570

819

777 closed by bot even though it's broken. Devs didn't reopen it

768 closed by bot even though it's broken. Devs didn't reopen it

Most people don't report these issues they just stop using low quality software...

paulinon commented 1 year ago

Hi folks,

We are very interested in addressing and fixing issues with the Unity editor crashing, but we currently have a hard time investigating them. It would be immensely helpful if you can provide something which we can locally replicate (e.g. a minimal, reproducible example) as a basis for troubleshooting.

@GabrielJadderson I see that this issue makes use of Authentication. Are you caching your User object? If so, one of our engineers shared a workaround where the Auth object is being cached, and the User is accessed by the CurrentUser property.

GabrielJadderson commented 1 year ago

Thanks for getting back to me and thanks for working on this @paulinon. I am looking at this: https://github.com/firebase/firebase-unity-sdk/issues/819#issuecomment-1670457786 We are not caching the User Object at all. We are only caching the FirebaseAuth using FirebaseAuth.GetAuth(firebaseApp); I am going to use DefaultInstance instead of caching FireBaseAuth. We are also caching FirebaseApp Can we cache that? or should we use DefaultInstance there as well? @a-maurice

GabrielJadderson commented 1 year ago

Hi Again I am still getting a crash doing https://github.com/firebase/firebase-unity-sdk/issues/819#issuecomment-1670457786

GabrielJadderson commented 1 year ago

An update on this issue, It primarily happens when unity is recompiling your code changes. It also happens when unity is minimized and your editing code.

AlmostMatt commented 1 year ago

I am going to use DefaultInstance instead of caching FireBaseAuth. We are also caching FirebaseApp Can we cache that? or should we use DefaultInstance there as well?

Caching FirebaseAuth and using the DefaultInstance should both be fine. The same for App. The issue in 819 was specifically about referencing an old User variable, with a workaround of calling CurrentUser again in order to get the newer User object. If you are not caching the User object at all, then this may be a different issue than 819.

We are currently investigating both of these issues.