firebase / quickstart-unity

Firebase Quickstart Samples for Unity
https://firebase.google.com/games
Apache License 2.0
832 stars 428 forks source link

6.15.0 - Unity constantly crashes when entering play mode for the second time #698

Closed eladleb closed 4 years ago

eladleb commented 4 years ago

Unity editor version: 2019.3.15 Firebase Unity SDK version: 6.15.0 Source you installed the SDK: Unity Package Manager. Firebase plugins in use: everything except firestore Additional SDKs you are using: Facebook & AdMob Platform you are using the Unity editor on Mac Platform you are targeting: iOS, Android Scripting Runtime: IL2CPP

Please describe the issue here:

After updating to 6.15.0 I started seeing this warning when I enter play mode for the 1st time: Future with handle 1 still exists though its backing API is being deleted

After this warning is shown, the next time I enter play mode, unity crashes :(

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? - I didn't try.

What's the issue repro rate? 100% of the time.


Future with handle 1 still exists though its backing API 0xC624DCD0 is being deleted. Please call Future::Release() before deleting the backing API. UnityEngine.Debug:LogWarning(Object) Firebase.Platform.FirebaseLogger:LogMessage(PlatformLogLevel, String) (at Z:/tmp/tmp.la3ltWQdKA/firebase/app/client/unity/src/Unity/FirebaseLogger.cs:92) Firebase.LogUtil:LogMessage(LogLevel, String) (at Z:/tmp/tmp.txs8ldQ514/firebase/app/client/unity/proxy/LogUtil.cs:68) Firebase.LogUtil:LogMessageFromCallback(LogLevel, String) (at Z:/tmp/tmp.txs8ldQ514/firebase/app/client/unity/proxy/LogUtil.cs:76) Firebase.AppUtilPINVOKE:PollCallbacks() Firebase.AppUtil:PollCallbacks() (at Z:/tmp/tmp.txs8ldQ514/firebase/app/client/unity/proxy/AppUtil.cs:32) Firebase.Platform.FirebaseAppUtils:PollCallbacks() (at Z:/tmp/tmp.txs8ldQ514/firebase/app/client/unity/proxy/FirebaseAppUtils.cs:33) Firebase.Platform.FirebaseHandler:Update() (at Z:/tmp/tmp.la3ltWQdKA/firebase/app/client/unity/src/Unity/FirebaseHandler.cs:205) Firebase.Platform.FirebaseMonoBehaviour:Update() (at Z:/tmp/tmp.la3ltWQdKA/firebase/app/client/unity/src/Unity/FirebaseMonoBehaviour.cs:45)


Another similar log:

Future with handle 1 still exists though its backing API 0x43313BF0 is being deleted. Please call Future::Release() before deleting the backing API. UnityEngine.Debug:LogWarning(Object) Firebase.Platform.FirebaseLogger:LogMessage(PlatformLogLevel, String) (at Z:/tmp/tmp.la3ltWQdKA/firebase/app/client/unity/src/Unity/FirebaseLogger.cs:92) Firebase.LogUtil:LogMessage(LogLevel, String) (at Z:/tmp/tmp.txs8ldQ514/firebase/app/client/unity/proxy/LogUtil.cs:68) Firebase.LogUtil:LogMessageFromCallback(LogLevel, String) (at Z:/tmp/tmp.txs8ldQ514/firebase/app/client/unity/proxy/LogUtil.cs:76) Firebase.AppUtilPINVOKE:PollCallbacks() Firebase.AppUtil:PollCallbacks() (at Z:/tmp/tmp.txs8ldQ514/firebase/app/client/unity/proxy/AppUtil.cs:32) Firebase.Platform.FirebaseAppUtils:PollCallbacks() (at Z:/tmp/tmp.txs8ldQ514/firebase/app/client/unity/proxy/FirebaseAppUtils.cs:33) Firebase.Platform.FirebaseHandler:Update() (at Z:/tmp/tmp.la3ltWQdKA/firebase/app/client/unity/src/Unity/FirebaseHandler.cs:205) Firebase.Platform.FirebaseEditorDispatcher:Update() (at Z:/tmp/tmp.la3ltWQdKA/firebase/app/client/unity/src/Unity/FirebaseEditorDispatcher.cs:102) UnityEditor.EditorApplication:Internal_CallUpdateFunctions() (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorApplication.cs:310)

google-oss-bot commented 4 years ago

This issue does not seem to follow the issue template. Make sure you provide all the required information.

npicouet commented 4 years ago

I'm having this issue as well. Editor log is spamming this over and over: Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.3.13f1/Unity.app/Contents/Frameworks/Mono/lib/libPackages/com.google.firebase.app/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.bundle

EDIT: Not sure on the exact cause, but yeah its completely unusable. Crashes every time code compiles after hitting play once in editor.

brianchasalow commented 4 years ago

Seeing the same crash here as of 6.15.0, totally unusable. need to roll back to .14. Similar crash. Future with handle 1 still exists though its backing API 0x40F2420 is being deleted. Please call Future::Release() before deleting the backing API.

@mikehaney24

Seems to fire on: DatabaseReference userStatusDatabaseRef = FirebaseDatabase.DefaultInstance.GetReference("/status/" + uid);

Future with handle 1 still exists though its backing API 0x40F2420 is being deleted. Please call Future::Release() before deleting the backing API. UnityEngine.Debug:LogWarning(Object) Firebase.Platform.FirebaseLogger:LogMessage(PlatformLogLevel, String) (at Z:/tmp/tmp.la3ltWQdKA/firebase/app/client/unity/src/Unity/FirebaseLogger.cs:92) Firebase.LogUtil:LogMessage(LogLevel, String) (at Z:/tmp/tmp.txs8ldQ514/firebase/app/client/unity/proxy/LogUtil.cs:68) Firebase.LogUtil:LogMessageFromCallback(LogLevel, String) (at Z:/tmp/tmp.txs8ldQ514/firebase/app/client/unity/proxy/LogUtil.cs:76) Firebase.Database.Internal.DatabaseInternalPINVOKE:InternalFirebaseDatabase_GetReference__SWIG_1(HandleRef, String) Firebase.Database.Internal.InternalFirebaseDatabase:GetReference(String) (at Z:/tmp/tmp.DJxfWWKRuH/firebase/database/client/unity/proxy/InternalFirebaseDatabase.cs:92) Firebase.Database.FirebaseDatabase:GetReference(String) (at Z:/tmp/tmp.DJxfWWKRuH/firebase/database/client/unity/proxy/FirebaseDatabase.cs:182) FirebaseConnector:CheckOnlineStatus(Boolean) (at Assets/LightDiver/Firebase/FirebaseConnector.cs:1016)

eladleb commented 4 years ago

We also rolled back to 6.14.1 until someone from firebase could provide us with some guidance :(

mohamad-al-amaary commented 4 years ago

There goes my excitement for the unity cleanup crashfix for ios watchdog transgression issue rolled out with this version, meh

mohamad-al-amaary commented 4 years ago

Just tested a little more, it's not about GetReference for my specific project as I didn't use a database for this one. I use Auth, Remote Config, Analytics only for this and after debugging it seems it's only about Auth module. I use similar code to the docs and only use Anonymous authentication, hope it helps you solve it :) If the person above me had an issue with GetReference, I'm afraid it might also affect database module, did not test in my other projects.

Edit: Doesn't happen as often on Windows as on Mac

aidanwolf commented 4 years ago

Same exact issue after upgrading to 6.15.

Found this in the crash report, seems to be Firebase Auth related: Thread 57 Crashed:: Finalizer 0 libsystem_kernel.dylib 0x00007fff6f81e33a __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007fff6f8dae60 pthread_kill + 430 2 libsystem_c.dylib 0x00007fff6f7a5808 abort + 120 3 com.unity3d.UnityEditor5.x 0x00000001065f32de HandleSignal(int, __siginfo*, void*) + 62 4 libmonobdwgc-2.0.dylib 0x0000000142e7a16d mono_chain_signal + 79 5 libmonobdwgc-2.0.dylib 0x0000000142d4b3ef mono_sigsegv_signal_handler + 414 6 libsystem_platform.dylib 0x00007fff6f8cf5fd _sigtramp + 29 7 ??? 000000000000000000 0 + 0 8 FirebaseCppApp-6_15_0.bundle 0x00000001648fd8de firebase::FutureBackingData::~FutureBackingData() + 110 9 FirebaseCppApp-6_15_0.bundle 0x00000001648fdc5f firebase::ReferenceCountedFutureImpl::~ReferenceCountedFutureImpl() + 367 10 FirebaseCppApp-6_15_0.bundle 0x000000016421d364 firebase::auth::Auth::DeleteInternal() + 516 11 FirebaseCppApp-6_15_0.bundle 0x000000016421d429 firebase::auth::Auth::~Auth() + 9 12 FirebaseCppApp-6_15_0.bundle 0x00000001640f0423 firebase::CppInstanceManager<firebase::auth::Auth>::ReleaseReference(firebase::auth::Auth*) + 323 13 ??? 0x000000016632f18b 0 + 6009581963 14 ??? 0x000000016632c883 0 + 6009571459

EricBatlle commented 4 years ago

Similar problem using RealtimeDatabase in Unity 2019.3 on a Xiaomi Pocophone.

public void OnDatabaseStuff()
    {
        database.GetReference("users/Eric").GetValueAsync().ContinueWithOnMainThread(task =>
        {
            if (task.IsFaulted)
            {
                // Handle the error...
            }
            else if (task.IsCompleted)
            {
                DataSnapshot snapshot = task.Result;
                // Do something with snapshot...
                dataShot = snapshot;
                foreach (var childShot in dataShot.Children)
                {
                    Debug.Log(childShot.Value.ToString());
                }
                Dictionary<string, object> child = dataShot.Value as Dictionary<string, object>;
                Debug.Log(child["Eric"].ToString());
            }
        });
    }

I was thinking that changing from ContinueWith to ContinueWithOnMainThread will solve it, but it doesn't. Still showing the warning, any idea?

shlighter commented 4 years ago

Similiar issue SDK 6.15.0 Unity 2019.3.13f1 every time SetValueAsync is called . Rolling back to 6.14 Future with handle 1 still exists though its backing API 0x3FDCABE0 is being deleted. Please call Future::Release() before deleting the backing API. UnityEngine.Debug:LogWarning(Object)

copypasteearth commented 4 years ago

I'm having the same issue only using Auth 6.15

public class menu : MonoBehaviour
{
        public GameObject signInButton;
        public GameObject registerPanel;
        public GameObject registerInputPanel;
        public InputField registerEmailText;
        public InputField registerPasswordText;
        public GameObject signinPanel;
        public InputField signinEmail;
        public InputField signinPassword;
        FirebaseApp app;
        Firebase.Auth.FirebaseAuth auth;
        protected Firebase.Auth.FirebaseAuth otherAuth;
        Firebase.Auth.FirebaseUser user;
        public bool isSignedIn = false;
        private Firebase.AppOptions otherAuthOptions = new Firebase.AppOptions {
                ApiKey = "",
                AppId = "",
                ProjectId = ""
        };
        // Start is called before the first frame update
        void Start()
    {
                //what is going

                Firebase.FirebaseApp.CheckAndFixDependenciesAsync ().ContinueWithOnMainThread (task => {
                        var dependencyStatus = task.Result;
                        if (dependencyStatus == Firebase.DependencyStatus.Available) {
                                // Create and hold a reference to your FirebaseApp,
                                // where app is a Firebase.FirebaseApp property of your application class.
                                //Firebase.AppOptions ops = new Firebase.AppOptions ();
                                //app = Firebase.FirebaseApp.Create (ops);
                                InitializeFirebase ();
                                //app = Firebase.FirebaseApp.DefaultInstance;

                                print ("success with firebase");

                                // Set a flag here to indicate whether Firebase is ready to use by your app.
                        } else {
                                UnityEngine.Debug.LogError (System.String.Format (
                                  "Could not resolve all Firebase dependencies: {0}", dependencyStatus));
                                // Firebase Unity SDK is not safe to use here.
                        }
                });
        }

    // Update is called once per frame
    void Update()
    {

    }
        public void registerClicked ()
    {
                registerPanel.SetActive (false);
                registerInputPanel.SetActive (true);
    }
        public void actualSignIn ()
    {
                registerPanel.SetActive (false);
                signinPanel.SetActive (true);
        }
        public void signInButtonClicked ()
    {
        if (!isSignedIn) {
                        registerPanel.SetActive (true);
        } else {
                        auth.SignOut ();
                        print ("signed out");
                }

    }
        public void doSignIn ()
    {
                signinPanel.SetActive (false);
                auth.SignInWithEmailAndPasswordAsync (signinEmail.text, signinPassword.text).ContinueWith (task => {
                        if (task.IsCanceled) {
                                Debug.LogError ("SignInWithEmailAndPasswordAsync was canceled.");
                                return;
                        }
                        if (task.IsFaulted) {
                                Debug.LogError ("SignInWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                                return;
                        }

                        Firebase.Auth.FirebaseUser newUser = task.Result;
                        Debug.LogFormat ("User signed in successfully: {0} ({1})",
                            newUser.DisplayName, newUser.UserId);
                });
        }
        public void createAccount ()
    {
                registerInputPanel.SetActive (false);
                print ("email: " + registerEmailText.text + "     password: " + registerPasswordText.text);
                auth.CreateUserWithEmailAndPasswordAsync (registerEmailText.text, registerPasswordText.text).ContinueWith (task => {
                        if (task.IsCanceled) {
                                Debug.LogError ("CreateUserWithEmailAndPasswordAsync was canceled.");
                                return;
                        }
                        if (task.IsFaulted) {
                                Debug.LogError ("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                                return;
                        }

                        // Firebase user has been created.
                        Firebase.Auth.FirebaseUser newUser = task.Result;
                        Debug.LogFormat ("Firebase user created successfully: {0} ({1})",
                            newUser.DisplayName, newUser.UserId);
                });
        }
        void OnDestroy ()
        {
                print ("destroy");

                auth.StateChanged -= AuthStateChanged;

                auth = null;
                if (otherAuth != null) {
                        otherAuth.StateChanged -= AuthStateChanged;

                        otherAuth = null;
                }

        }
        void InitializeFirebase ()
        {
                print ("Setting up Firebase Auth");
                auth = Firebase.Auth.FirebaseAuth.DefaultInstance;
                auth.StateChanged += AuthStateChanged;

                // Specify valid options to construct a secondary authentication object.
                if (otherAuthOptions != null &&
                    !(String.IsNullOrEmpty (otherAuthOptions.ApiKey) ||
                      String.IsNullOrEmpty (otherAuthOptions.AppId) ||
                      String.IsNullOrEmpty (otherAuthOptions.ProjectId))) {
                        try {
                                otherAuth = Firebase.Auth.FirebaseAuth.GetAuth (Firebase.FirebaseApp.Create (
                                  otherAuthOptions, "Secondary"));
                                otherAuth.StateChanged += AuthStateChanged;

                        } catch (Exception) {
                                print ("ERROR: Failed to initialize secondary authentication object.");
                        }
                }
                AuthStateChanged (this, null);
        }

    private void OnApplicationQuit ()
    {
                print ("app quiting");
                //app.Dispose ();
                //FirebaseApp.DefaultInstance.Dispose ();
        }

    void AuthStateChanged (object sender, System.EventArgs eventArgs)
        {
                if (auth.CurrentUser != user) {
                        bool signedIn = user != auth.CurrentUser && auth.CurrentUser != null;
                        if (!signedIn && user != null) {
                                print ("Signed out " + user.UserId);
                        }
                        user = auth.CurrentUser;
                        if (signedIn) {
                                isSignedIn = true;
                                signInButton.transform.Find ("Text").gameObject.GetComponent<Text> ().text = "Sign Out";
                                print ("Signed in " + user.UserId);

                        }
                }
        }
cynthiajoan commented 4 years ago

Thanks all for providing all the details. We are working on a fix and will post update when there is progress.

jonahgoldsaito commented 4 years ago

I'm hitting the same issue on 2nd editor run, which is unfortunate as upgrading to 6.15.0 from 6.14.1 is the only way I was able to solve a build error for iOS.

Not sure if it's related but just in case it is: I opened the project (2019.3.8 & 6.15.0), and though I didn't build in Editor or to device, after about 30 minutes Unity suddenly crashed while I had another app in focus. Pasting the OSX crash log in this Google doc in case it highlights anything.

seekinglambda commented 4 years ago

Also hitting the same issue (6.15.0 & 2019.3.6/2019.4.0). Seems related to garbage collection of the Auth DefaultInstance in my case.

The only thing required for me to hit it, is to have a single line, running in a script in a GameObject on the scene: auth = FirebaseAuth.DefaultInstance;

I have tried variants like having this line within CheckAndFixDependenciesAsync, having "auth" be a member variable instead of local, having it be a static member variable, ...

The behavior is that it works fine on the first run (although the editor logs show a lot of "Fallback handler couldn't load ..." but I think I have ruled out this being related).

On the second run, it always instantly crashes with the following:

0 0x00000182781d10 in firebase::(anonymous namespace)::FutureProxyManager::UnregisterCallback(void*)

1 0x0000018277f8de in firebase::FutureBackingData::~FutureBackingData()

2 0x0000018277fc5f in firebase::ReferenceCountedFutureImpl::~ReferenceCountedFutureImpl()

3 0x0000018209f364 in firebase::auth::Auth::DeleteInternal()

4 0x0000018209f429 in firebase::auth::Auth::~Auth()

5 0x00000181f72423 in firebase::CppInstanceManager::ReleaseReference(firebase::auth::Auth*)

6 0x00000164f0430b in (wrapper managed-to-native) Firebase.Auth.AuthUtilPINVOKE:FirebaseAuth_ReleaseReferenceInternal (System.Runtime.InteropServices.HandleRef) {0x7fed07ec3170} + 0x11b (0x164f041f0 0x164f04415) [0x167535c80 - Unity Child Domain]

7 0x00000164f01863 in Firebase.Auth.FirebaseAuth:Dispose () {0x7fed06702d90} + 0x73 (0x164f017f0 0x164f0188e) [0x167535c80 - Unity Child Domain]

8 0x000001628a375c in (wrapper runtime-invoke) object:runtime_invoke_virtual_voidthis (object,intptr,intptr,intptr) {0x7fecff2cf508} + 0x16c (0x1628a35f0 0x1628a3965) [0x167535c80 - Unity Child Domain]

9 0x000001480e678b in mono_gc_run_finalize

10 0x000001480e83d1 in finalizer_thread

11 0x000001480aef44 in start_wrapper

12 0x00000148122e22 in GC_inner_start_routine

13 0x00000148122db7 in GC_start_routine

14 0x007fff6945ae65 in _pthread_start

15 0x007fff6945683b in thread_start

Curiously, out of maybe 100 different attempts, there was one series of plays where the crash did not happen. This was after I added DontDestroyOnLoad to my GameObject that contains the line. However, at a later point, I tried checking "single instance" as well, and after that the crash immediately returned. Now I can't replicate the working setup anymore.

lozan commented 4 years ago

I am also having the same issue. Every second run the editor crashes. Running on Ubuntu 20.04 (x86_64), I tried with Unity 2019.4.0 and with 2019.3.15. I also tried installing Firebase through Package Manager and manually, but it made no difference at all. I am only using Firebase Auth and I tried with a small test app which does only anonymous authentication and othing else. Here's the tail of the editor log (the relevant part):

Reloading assemblies for play mode.
Begin MonoManager ReloadAssembly
Fallback handler could not load library /home/user/Applications/unity/editors/2019.4.0f1/Editor/Data/Mono/lib/libAssets/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.so
Fallback handler could not load library /home/user/Applications/unity/editors/2019.4.0f1/Editor/Data/Mono/lib/libAssets/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.so
Fallback handler could not load library /home/user/Applications/unity/editors/2019.4.0f1/Editor/Data/Mono/lib/libAssets/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.so
Fallback handler could not load library /home/user/Applications/unity/editors/2019.4.0f1/Editor/Data/Mono/lib/libAssets/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.so
Fallback handler could not load library /home/user/Applications/unity/editors/2019.4.0f1/Editor/Data/Mono/lib/libAssets/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.so
Fallback handler could not load library /home/user/Applications/unity/editors/2019.4.0f1/Editor/Data/Mono/lib/libAssets/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.so
Caught fatal signal - signo:11 code:128 errno:0 addr:(nil)
Obtained 16 stack frames.
#0  0x007f5efa4ce3c0 in funlockfile
#1  0x007f5d928222d2 in firebase::CleanupNotifier::UnregisterObject(void*)
#2  0x007f5d92827a17 in firebase::(anonymous namespace)::FutureProxyManager::UnregisterCallback(void*)
#3  0x007f5d928250f2 in firebase::FutureBackingData::~FutureBackingData()
#4  0x007f5d92825459 in firebase::ReferenceCountedFutureImpl::~ReferenceCountedFutureImpl()
#5  0x007f5d921ae680 in firebase::auth::Auth::DeleteInternal()
#6  0x007f5d92068019 in Firebase_Auth_CSharp_FirebaseAuth_ReleaseReferenceInternal
#7  0x00000041dd8cdb in (wrapper managed-to-native) Firebase.Auth.AuthUtilPINVOKE:FirebaseAuth_ReleaseReferenceInternal (System.Runtime.InteropServices.HandleRef)
#8  0x00000041dd64b8 in Firebase.Auth.FirebaseAuth:Dispose ()
#9  0x00000041ef3c75 in (wrapper runtime-invoke) object:runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr)
#10 0x007f5dcb7525ef in mono_callspec_cleanup
#11 0x00000000000001 in (Unknown)
#12 0x00000041dd64b8 in Firebase.Auth.FirebaseAuth:Dispose ()
#13 0x00000041ef3c75 in (wrapper runtime-invoke) object:runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr)
#14 0x007f5dcb7525ef in mono_callspec_cleanup
#15 0x007f5dcbaa1c00 in (Unknown)
Launching bug reporter
[Unity Package Manager (Upm)]
Parent process [143949] was terminated

I know the lines with "Fallback handler could not load library" are another bug, but somehow that's not causing the crash. Those lines are in the log even if I run the application once, but the Editor doesn't crash because of that. However, the issues may be related (with the locking).

For the time being, I rolled back to 6.14.1, which doesn't have this bug, but I hope this will be resolved soon

keskin commented 4 years ago

Also hitting the same issue (6.15.0 & 2019.3.6/2019.4.0). Seems related to garbage collection of the Auth DefaultInstance in my case.

The only thing required for me to hit it, is to have a single line, running in a script in a GameObject on the scene: auth = FirebaseAuth.DefaultInstance;

I have tried variants like having this line within CheckAndFixDependenciesAsync, having "auth" be a member variable instead of local, having it be a static member variable, ...

The behavior is that it works fine on the first run (although the editor logs show a lot of "Fallback handler couldn't load ..." but I think I have ruled out this being related).

On the second run, it always instantly crashes with the following:

0 0x00000182781d10 in firebase::(anonymous namespace)::FutureProxyManager::UnregisterCallback(void*)

1 0x0000018277f8de in firebase::FutureBackingData::~FutureBackingData()

2 0x0000018277fc5f in firebase::ReferenceCountedFutureImpl::~ReferenceCountedFutureImpl()

3 0x0000018209f364 in firebase::auth::Auth::DeleteInternal()

4 0x0000018209f429 in firebase::auth::Auth::~Auth()

5 0x00000181f72423 in firebase::CppInstanceManagerfirebase::auth::Auth::ReleaseReference(firebase::auth::Auth*)

6 0x00000164f0430b in (wrapper managed-to-native) Firebase.Auth.AuthUtilPINVOKE:FirebaseAuth_ReleaseReferenceInternal (System.Runtime.InteropServices.HandleRef) {0x7fed07ec3170} + 0x11b (0x164f041f0 0x164f04415) [0x167535c80 - Unity Child Domain]

7 0x00000164f01863 in Firebase.Auth.FirebaseAuth:Dispose () {0x7fed06702d90} + 0x73 (0x164f017f0 0x164f0188e) [0x167535c80 - Unity Child Domain]

8 0x000001628a375c in (wrapper runtime-invoke) object:runtime_invoke_virtual_voidthis (object,intptr,intptr,intptr) {0x7fecff2cf508} + 0x16c (0x1628a35f0 0x1628a3965) [0x167535c80 - Unity Child Domain]

9 0x000001480e678b in mono_gc_run_finalize

10 0x000001480e83d1 in finalizer_thread

11 0x000001480aef44 in start_wrapper

12 0x00000148122e22 in GC_inner_start_routine

13 0x00000148122db7 in GC_start_routine

14 0x007fff6945ae65 in _pthread_start

15 0x007fff6945683b in thread_start

Curiously, out of maybe 100 different attempts, there was one series of plays where the crash did not happen. This was after I added DontDestroyOnLoad to my GameObject that contains the line. However, at a later point, I tried checking "single instance" as well, and after that the crash immediately returned. Now I can't replicate the working setup anymore.

in my case, this is the problem. auth = FirebaseAuth.DefaultInstance;

jonahgoldsaito commented 4 years ago

Does 6.15 run in Editor successfully (multiple times) on anyone's system running 2019.3.8+, especially on OSX? The dev team, for example–it must have run and passed tests, and if so, perhaps there's some setup we can replicate. I realize it may take a bit to track down the bug and have a stable release, but I'm also in a scenario where I can't roll back to 6.14.1, unfortunately.

I know the dev team must be running primarily on *nix, but y'all must be working from home a bunch now on MBPros, unless everything changed since I left. If so, any tips? I realize this thread is self selecting, so anyone for whom it works wouldn't be reading this, unless perhaps it's your job or you're incredibly good world developer citizens :)

Thanks!

gurkankilic commented 4 years ago

I have dealt with the same problem for the past 15 days. Unity was crashing when CheckAndFixDependenciesAsync was called a second time.

The tutorial below solved the problem. https://spin.atomicobject.com/2020/06/09/firebase-unity-user-accounts/

Edit: Sorry, the same problem reappears. Not working.

Blazerker commented 4 years ago

I have the same issue. Have an issue on 2019.4.0 and 2019.3.x. I've tracked it down to the auth.StateChanged += AuthStateChanged; callback. I've also tried unsubscribing it before the app closes, but that also doesn't work.

Process:               Unity [51548]
Path:                  /Applications/Unity/*/Unity.app/Contents/MacOS/Unity
Identifier:            com.unity3d.UnityEditor5.x
Version:               Unity version 2019.4.0f1 (2019.4.0f1)
Code Type:             X86-64 (Native)
Parent Process:        Unity Hub [566]
Responsible:           Unity Hub [566]
User ID:               501

Date/Time:             2020-06-21 12:28:47.330 +0200
OS Version:            Mac OS X 10.15.5 (19F101)
Report Version:        12
Bridge OS Version:     4.5 (17P5300)
Anonymous UUID:        AA1C1D97-B928-F6F0-99EB-36EBB990E6E5

Sleep/Wake UUID:       D1994F25-EF6B-4F00-A4B6-B921FC25792F

Time Awake Since Boot: 240000 seconds
Time Since Wake:       18000 seconds

System Integrity Protection: enabled

Crashed Thread:        68  Finalizer

Exception Type:        EXC_BAD_ACCESS (SIGABRT)
Exception Codes:       EXC_I386_GPFLT
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
abort() called
Reloading assemblies for play mode.
Begin MonoManager ReloadAssembly
Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.0f1/Unity.app/Contents/Frameworks/Mono/lib/libPackages/com.google.firebase.app/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.bundle
Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.0f1/Unity.app/Contents/Frameworks/Mono/lib/libPackages/com.google.firebase.app/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.bundle.dylib
Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.0f1/Unity.app/Contents/Frameworks/Mono/lib/libPackages/com.google.firebase.app/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.bundle.so
Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.0f1/Unity.app/Contents/Frameworks/Mono/lib/libPackages/com.google.firebase.app/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.bundle
Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.0f1/Unity.app/Contents/Frameworks/Mono/lib/libPackages/com.google.firebase.app/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.bundle
Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.0f1/Unity.app/Contents/Frameworks/Mono/lib/libPackages/com.google.firebase.app/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.bundle.dylib
Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.0f1/Unity.app/Contents/Frameworks/Mono/lib/libPackages/com.google.firebase.app/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.bundle.so
Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.0f1/Unity.app/Contents/Frameworks/Mono/lib/libPackages/com.google.firebase.app/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.bundle
Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.0f1/Unity.app/Contents/Frameworks/Mono/lib/libPackages/com.google.firebase.app/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.bundle
Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.0f1/Unity.app/Contents/Frameworks/Mono/lib/libPackages/com.google.firebase.app/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.bundle.dylib
Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.0f1/Unity.app/Contents/Frameworks/Mono/lib/libPackages/com.google.firebase.app/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.bundle.so
Fallback handler could not load library /Applications/Unity/Hub/Editor/2019.4.0f1/Unity.app/Contents/Frameworks/Mono/lib/libPackages/com.google.firebase.app/Firebase/Plugins/x86_64/FirebaseCppApp-6_15_0.bundle
Obtained 16 stack frames.
#0  0x0000017fdebd10 in firebase::(anonymous namespace)::FutureProxyManager::UnregisterCallback(void*)
#1  0x0000017fde98de in firebase::FutureBackingData::~FutureBackingData()
#2  0x0000017fde9c5f in firebase::ReferenceCountedFutureImpl::~ReferenceCountedFutureImpl()
#3  0x0000017f709364 in firebase::auth::Auth::DeleteInternal()
#4  0x0000017f709429 in firebase::auth::Auth::~Auth()
#5  0x0000017f5dc423 in firebase::CppInstanceManager<firebase::auth::Auth>::ReleaseReference(firebase::auth::Auth*)
#6  0x000001616f5e6b in  (wrapper managed-to-native) Firebase.Auth.AuthUtilPINVOKE:FirebaseAuth_ReleaseReferenceInternal (System.Runtime.InteropServices.HandleRef) {0x7fefd8024928} + 0x11b (0x1616f5d50 0x1616f5f75) [0x184406c80 - Unity Child Domain]
#7  0x000001616f33c3 in  Firebase.Auth.FirebaseAuth:Dispose () {0x7fefcac85390} + 0x73 (0x1616f3350 0x1616f33ee) [0x184406c80 - Unity Child Domain]
#8  0x00000164e1275c in  (wrapper runtime-invoke) object:runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr) {0x7fefd1933708} + 0x16c (0x164e125f0 0x164e12965) [0x184406c80 - Unity Child Domain]
#9  0x000001438f678b in mono_gc_run_finalize
#10 0x000001438f83d1 in finalizer_thread
#11 0x000001438bef44 in start_wrapper
#12 0x00000143932e22 in GC_inner_start_routine
#13 0x00000143932db7 in GC_start_routine
#14 0x007fff69f89109 in _pthread_start
#15 0x007fff69f84b8b in thread_start
Launching bug reporter
WARNING: Future with handle 1 still exists though its backing API 0xC887C368 is being deleted. Please call Future::Release() before deleting the backing API.
WARNING: Future with handle 2 still exists though its backing API 0xC887C368 is being deleted. Please call Future::Release() before deleting the backing API.
WARNING: Future with handle 2 still exists though its backing API 0xC887BDB0 is being deleted. Please call Future::Release() before deleting the backing API.
WARNING: Future with handle 3 still exists though its backing API 0xC887BDB0 is being deleted. Please call Future::Release() before deleting the backing API.
[Unity Package Manager (Upm)]
Parent process [54276] was terminated
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QObject(0x7f83cbf4a300), parent's thread is QThread(0x7f83cbc0ef20), current thread is Thread(0x7f83ccbb9460)
eladleb commented 4 years ago

Hey @cynthiajoan

Thanks all for providing all the details. We are working on a fix and will post update when there is progress.

Any ETA on resolving this issue..? Or are there any workarounds aside from downgrading?

Chris97e commented 4 years ago

I also have the same issue, Unity editor crashes when I enter in play mode for second time. This only happens if I register a user with auth Firebase.

matiasticbits commented 4 years ago

I also have this issue using Unity 2018.4.23f1 and Firebase 6.15.0.


Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) Firebase.Auth.AuthUtilPINVOKE.FirebaseAuth_ReleaseReferenceInternal (System.Runtime.InteropServices.HandleRef) [0x00010] in <d1574d4ca4ed4f10bad0bdadaac0aaa7>:0
  at Firebase.Auth.FirebaseAuth.ReleaseReferenceInternal (Firebase.Auth.FirebaseAuth) [0x00000] in Z:\tmp\tmp.poUq23PLco\firebase\auth\client\unity\proxy\FirebaseAuth.cs:720
  at Firebase.Auth.FirebaseAuth.DisposeInternal () [0x000fc] in Z:\tmp\tmp.poUq23PLco\firebase\auth\client\unity\proxy\FirebaseAuth.cs:240
  at Firebase.Auth.FirebaseAuth.Dispose () [0x00000] in Z:\tmp\tmp.poUq23PLco\firebase\auth\client\unity\proxy\FirebaseAuth.cs:105
  at Firebase.Auth.FirebaseAuth.OnAppDisposed (object,System.EventArgs) [0x00000] in Z:\tmp\tmp.poUq23PLco\firebase\auth\client\unity\proxy\FirebaseAuth.cs:199
  at Firebase.FirebaseApp.Dispose () [0x0000b] in Z:\tmp\tmp.txs8ldQ514\firebase\app\client\unity\proxy\FirebaseApp.cs:53
  at Firebase.FirebaseApp.Finalize () [0x00000] in Z:\tmp\tmp.txs8ldQ514\firebase\app\client\unity\proxy\FirebaseApp.cs:47
  at (wrapper runtime-invoke) object.runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr) [0x0001f] in <e1319b7195c343e79b385cd3aa43f5dc>:0```
webmonch commented 4 years ago

Unity 2019.2.19f1 Firebase 6.15

0 0x00000175385d10 in firebase::(anonymous namespace)::FutureProxyManager::UnregisterCallback(void*)

1 0x000001753838de in firebase::FutureBackingData::~FutureBackingData()

2 0x00000175383c5f in firebase::ReferenceCountedFutureImpl::~ReferenceCountedFutureImpl()

3 0x00000174ca3364 in firebase::auth::Auth::DeleteInternal()

4 0x00000174ca3429 in firebase::auth::Auth::~Auth()

5 0x00000174b76423 in firebase::CppInstanceManager::ReleaseReference(firebase::auth::Auth*)

6 0x0000017707107b in (wrapper managed-to-native) Firebase.Auth.AuthUtilPINVOKE:FirebaseAuth_ReleaseReferenceInternal (System.Runtime.InteropServices.HandleRef) {0x7ffed4a46720} + 0x11b (0x177070f60 0x177071185) [0x141286000 - Unity Child Domain]

7 0x0000017706e8e3 in Firebase.Auth.FirebaseAuth:Dispose () {0x7ffed204a990} + 0x73 (0x17706e870 0x17706e90e) [0x141286000 - Unity Child Domain]

alphabikram commented 4 years ago

same here ... wasted more than 2 days on this bug :(

0 0x00000156d2bd10 in firebase::(anonymous namespace)::FutureProxyManager::UnregisterCallback(void*)

1 0x00000156d298de in firebase::FutureBackingData::~FutureBackingData()

2 0x00000156d29c5f in firebase::ReferenceCountedFutureImpl::~ReferenceCountedFutureImpl()

3 0x00000156649364 in firebase::auth::Auth::DeleteInternal()

4 0x00000156649429 in firebase::auth::Auth::~Auth()

5 0x0000015651c423 in firebase::CppInstanceManager::ReleaseReference(firebase::auth::Auth*)

6 0x0000015a6177db in (wrapper managed-to-native) Firebase.Auth.AuthUtilPINVOKE:FirebaseAuth_ReleaseReferenceInternal (System.Runtime.InteropServices.HandleRef) {0x7fab7d142408} + 0x11b (0x15a6176c0 0x15a6178e5) [0x140805c80 - Unity Child Domain]

7 0x0000015a614ed3 in Firebase.Auth.FirebaseAuth:Dispose () {0x7fab7d542b90} + 0x73 (0x15a614e60 0x15a614efe) [0x140805c80 - Unity Child Domain]

8 0x0000014b0b63ec in (wrapper runtime-invoke) object:runtime_invoke_virtual_voidthis (object,intptr,intptr,intptr) {0x7fab7daf0f58} + 0x16c (0x14b0b6280 0x14b0b65f5) [0x140805c80 - Unity Child Domain]

9 0x000001388a767b in mono_gc_run_finalize

10 0x000001388a92c1 in finalizer_thread

11 0x0000013886fd0d in start_wrapper

12 0x000001388e3d12 in GC_inner_start_routine

13 0x000001388e3ca7 in GC_start_routine

14 0x007fff72fdb109 in _pthread_start

15 0x007fff72fd6b8b in thread_start

Launching bug reporter

jonahgoldsaito commented 4 years ago

@cynthiajoan - If release schedules and juggling other features/fixes are holding this up, is there a patch we can implement in the meantime?

At the moment this is rendering my workflow super painful 😵

Blazerker commented 4 years ago

Rolling back to Version 6.14.1 in the Package Manager at least temporarily fixed the crash for me allowing me to continue working until this issue is resolved.

matiasticbits commented 4 years ago

I can reproduce this by selecting reimport to any script file after I had just finished play mode in Unity Editor. Also calling FirebaseApp.DefaultInstance.Dispose(); directly inside the game will make Unity Editor crash.

amoswazana commented 4 years ago

Any updates on this issue? This is severely affecting our development workflow...

a-maurice commented 4 years ago

Hi all,

The Unity SDK has recently released 6.15.1, which we believe will fix this issue. Sorry for the delay, and if it does not solve the problem, please let us know.

eladleb commented 4 years ago

Awesome, after updating to 6.15.1 this no longer happens 👍