Skip to content

[Bug] Firebase 11.1 causing multiple issues #768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brenofurlanpixo opened this issue Jun 22, 2023 · 14 comments
Closed

[Bug] Firebase 11.1 causing multiple issues #768

brenofurlanpixo opened this issue Jun 22, 2023 · 14 comments
Labels
api: core closed-by-bot needs-info Need information for the developer stale Don't have recent activity type: question unity-editor Issues related to Firebase usage in Unity editor

Comments

@brenofurlanpixo
Copy link

brenofurlanpixo commented Jun 22, 2023

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2021.3.14f1
  • Firebase Unity SDK version: 11.1.0
  • Source you installed the SDK: UPM
  • Problematic Firebase Component: Crashlytics, Core
  • Other Firebase Components in use: Auth, Firestore, Storage, Messaging, Installation, Auth, Remote Config, Analytics
  • Additional SDKs you are using: iron-source
  • Platform you are using the Unity editor on: mac, windows and linux
  • Platform you are targeting: iOS and Android
  • Scripting Runtime: IL2CPP
  • Pre-built SDK from the website or open-source from this repo: Website

[REQUIRED] Please describe the issue here:

Since we'd updated the Firebase SDK to 11.0+ we've found several issues across our project:

Editor - NOT FIXED

After updating we are occasionally experiencing Editor crashes that are linked to the Firebase SDK. We haven't been able to specifically identify where, although I'm going to provide some logs as it may be useful:

	Managed Stacktrace:
=================================================================
	  at <unknown> <0xffffffff>
	  at Firebase.Auth.AuthUtilPINVOKE:FirebaseUser_UserId_get <0x000a5>
	  at Firebase.Auth.FirebaseUser:get_UserId <0x0004a>
	  at Pixodust.Firebase.Auth.FirebaseAuthHandler:get_FirebaseId <0x00032>
	  at DisconnectController:TryGetValidUserId <0x0003d>
	  at DisconnectController:FindUserId <0x00032>
	  at DisconnectController:Initialize <0x00032>
	  ...
	  at UnityEngine.Events.UnityAction`2:invoke_void_T0_T1 <0x000c8>
	  at UnityEngine.SceneManagement.SceneManager:Internal_SceneLoaded <0x00052>
	  at <Module>:runtime_invoke_void_Scene_int <0x00098

This only happens when trying to connect with Firebase services, there's also this other log:

FunctionsException: INTERNAL
Firebase.Functions.HttpsCallableReference.<CallAsync>b__9_0 (System.Threading.Tasks.Task`1[TResult] task) (at /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/functions/src/HttpsCallableReference.cs:88)
System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[TAntecedentResult,TResult].InnerInvoke () (at <41229cbbc9214cf28863fc47f2e1508c>:0)
System.Threading.Tasks.Task.Execute () (at <41229cbbc9214cf28863fc47f2e1508c>:0)
--- End of stack trace from previous location where exception was thrown ---

This happens on Editor, but you can see that we've got some logs for '/home/runner' path, perhaps this is an issue with Firebase CI?

Steps to reproduce:

It happens really occasionally, no specific steps are recorded but this issue is present in both MacOS Ventura 13.1 and Windows 11

Build - WORKAROUNDED

We found that running Android builds on Linux environments will output broken builds which cannot be opened.
This is due this error, when triggered Crashlytics can't generate the build_id property and will prevent the game from opening:

Assembly 'Packages/com.google.firebase.crashlytics/Firebase/Editor/Firebase.Crashlytics.Editor.dll' will not be loaded due to errors:

Unable to resolve reference 'UnityEditor.iOS.Extensions.Xcode'. Is the assembly missing or incompatible with the current platform?"

To solve this we had to add iOS Build Support for CI Android, which is not optimal.

If I can provide any further info or help please let me know, thanks :)

[EDIT]

Issue also present on MacOS 12.5

@paulinon paulinon added unity-editor Issues related to Firebase usage in Unity editor api: core and removed api: crashlytics new New issue. labels Jun 23, 2023
@paulinon
Copy link
Contributor

Hi @brenofurlanpixo,

Thanks for bringing this to our attention. For your editor, could you try if version 11.2.0 of the SDK resolves the issue? It may contain a fix for the crash you're facing. Could you also confirm if either iOS or Validate References is deselected in your Firebase.Crashlytics.Editor.dll file? This could be found in your Assets > Firebase > Editor folder.

@paulinon paulinon added the needs-info Need information for the developer label Jun 26, 2023
@brenofurlanpixo
Copy link
Author

Hey there @paulinon thanks for your reply!
I'll be updating the plugin version and will keep you updated if it solves the issue regarding the random crashes.

Also, here's the import config for the Crashlytics.Editor.dll

image

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Jun 26, 2023
@paulinon paulinon added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels Jun 26, 2023
@brenofurlanpixo
Copy link
Author

brenofurlanpixo commented Jun 27, 2023

Hello again!
We've updated the Firebase packages to the requested version although this doesn't seems to have it fixed.
We are trying to get a insightful log, the cause itself seems to be the very same, also it is related to scene reload + firebase requests running

UnityEngine.SceneManagement.SceneManager:Internal_SceneLoaded (UnityEngine.SceneManagement.Scene,UnityEngine.SceneManagement.LoadSceneMode) (at /Users/bokken/build/output/unity/unity/Runtime/Export/SceneManager/SceneManager.cs:244)

...

Obtained 4 stack frames.
#0  0x0000022791b5b3 in Firebase_Auth_CSharp_FirebaseUser_UserId_get
#1  0x0000020a3d52e9 in  (wrapper managed-to-native) Firebase.Auth.AuthUtilPINVOKE:FirebaseUser_UserId_get (System.Runtime.InteropServices.HandleRef) [{0x7fbd301ef3e0} + 0xf9]  (0x20a3d51f0 0x20a3d542a) [0x15e1bba80 - Unity Child Domain]
#2  0x007fbd35e83620 in (Unknown)
#3  0x007ff7b077cd20 in (Unknown)
Launching bug reporter

We're now able to reproduce this error following a step-by-step action, where we try to load a JSON from the Firebase Cloud Storage while loading a Scene

[Edit] Happens constantly with scene load/unload, not entirely linked with a Firebase request or something

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Jun 27, 2023
@brenofurlanpixo
Copy link
Author

Further tests showed that those are not only related with Scene load:

[remote] Dropped touch events: 1

Obtained 4 stack frames.
#0  0x007fd30b8ab388 in (Unknown)
#1  0x000001fbe29c89 in  (wrapper managed-to-native) Firebase.Auth.AuthUtilPINVOKE:FirebaseUser_UserId_get (System.Runtime.InteropServices.HandleRef) [{0x7fd2fc9ce7e0} + 0xf9]  (0x1fbe29b90 0x1fbe29dca) [0x1567dca80 - Unity Child Domain]
#2  0x007fd30a8cd380 in (Unknown)
#3  0x00000000000000 in (Unknown)

On this action we're just opening a screen where you can check whats the current save state (i.e. synced or not) with firebase

@paulinon
Copy link
Contributor

Hi @brenofurlanpixo,

Does unticking Validate References resolve the issue related to your build? Also, could you provide a minimal, reproducible example of your implementation along with the complete steps to replicate the issue related to the editor so that we can identify what's causing the crashes?

@paulinon paulinon added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels Jun 28, 2023
@brenofurlanpixo
Copy link
Author

Hey there @paulinon !

CI Issue fix Attempt

We've uploaded a modified version of crashlytics with the Validate References toggled off but it seems to not have the issue solved. Apart from not getting the build_id generated properly, it seems to have returned other errors:

TypeLoadException: Failure has occurred while loading a type.
Rethrow as TypeInitializationException: The type initializer for 'Firebase.Crashlytics.Editor.PathConstants' threw an exception.
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <c46c80684ad14b639dc9b13c1642b8bb>:0

Editor Crashes

I was investigating this very issue and found out that when calling FirebaseUser.UserId multiple times in the same session leads to this crash-ish unity editor.

We were handling it as property: public string FirebaseId => FirebaseUser?.UserId;
This were used called on some UI methods such as view.SetUserIdText(firebaseAuth.FirebaseId);
After some test and validation, we've found that:

  • Caching this value prevents crashing throughout Editor where it were crashing (such as app reload, opening UI and changing scenes).
    The implementation now is something like: public string FirebaseId => cachedFirebaseID ?? FirebaseUser?.UserId;
  • Upgrading the plugin from 11.1 -> 11.2 causes this to be very constant, where it crashes every single time I head to reload the game on editor
  • Downgrading it to 10.7 doesnt fix this, but on 9.6 it does (downgrading isn't an option tho, we've just verifying wether version was or was not working alongside with our implementation)

We're using a very straightforward implementation of Firebase.Auth (i.e.: there isn't too much going on on-top of it after grabbing the UserID value), but if I can provide with any further info let me know :)

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Jun 28, 2023
@paulinon
Copy link
Contributor

Hi @brenofurlanpixo,

Thanks for the update. It seems that the behavior you're facing with the build is similar to this issue in the External Dependency Manager repository. You may refer to this thread for updates.

Does the issue persist if you update your Unity editor to a later version (2022.3.4f1 is the latest LTS version)? It would be helpful if you provide a minimal, reproducible example as this could be used as a baseline for troubleshooting.

@paulinon paulinon added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels Jun 29, 2023
@google-oss-bot google-oss-bot added the stale Don't have recent activity label Jul 6, 2023
@google-oss-bot
Copy link

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

@brenofurlanpixo
Copy link
Author

brenofurlanpixo commented Jul 6, 2023

Hey there!
Just updating here to avoid auto-closing of this issue as it is not yet solved - we're keeping an eye on both threads
Sorry for the bit delay for providing the requested minimal example. We'll make some tests and provide it as soon as possible.
Thanks for your time :)

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer stale Don't have recent activity labels Jul 6, 2023
@paulinon paulinon added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels Jul 6, 2023
@cometa93
Copy link

cometa93 commented Jul 7, 2023

Same, 11.1v issues
#777

@MaxTheWhite
Copy link

Hello, we are facing same issues on 11.1, 11.2 versions.

  • Unity editor version: 2020.3.48f1
  • Firebase Unity SDK version: 11.1.0, 11.2.0
  • Source you installed the SDK: UPM
  • Other Firebase Components in use: Auth, Messaging, Installation, Auth, Remote Config, Analytics
  • Additional SDKs you are using: ApplovinMax, Appsflyer
  • Platform you are using the Unity editor on: windows
  • Platform you are targeting: iOS and Android
  • Scripting Runtime: IL2CPP

@google-oss-bot google-oss-bot added the stale Don't have recent activity label Jul 17, 2023
@google-oss-bot
Copy link

Hey @brenofurlanpixo. 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
Copy link

Since there haven't been any recent updates here, I am going to close this issue.

@brenofurlanpixo if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@AlkisFortuneFish
Copy link

AlkisFortuneFish commented Jul 24, 2023

We have just updated from Firebase 10.4.0 to 11.2.0 and we're getting this Editor crash randomly, across all our editors. In our case the call stack is:

Received signal SIGSEGV
Obtained 33 stack frames
0x00007fff9dfa5075 (FirebaseCppApp-11_2_0) uS::Socket::freeMessage
0x00007fff9dfd767d (FirebaseCppApp-11_2_0) uS::TLS::Context::operator bool
0x00007fff9dfdd12d (FirebaseCppApp-11_2_0) uS::TLS::Context::operator bool
0x00007fff9dfdd0d4 (FirebaseCppApp-11_2_0) uS::TLS::Context::operator bool
0x00007fff9dfcf485 (FirebaseCppApp-11_2_0) uS::TLS::Context::operator bool
0x00007fff9df5f9af (FirebaseCppApp-11_2_0) Firebase_Auth_CSharp_FirebaseUser_Token
0x000002a9e074583a (Mono JIT Code) (wrapper managed-to-native) Firebase.Auth.AuthUtilPINVOKE:FirebaseUser_Token (System.Runtime.InteropServices.HandleRef,bool)
0x000002a9e07454e3 (Mono JIT Code) [Firebase.Auth_fixed.cs:3623] Firebase.Auth.FirebaseUser:TokenAsync (bool) 
0x000002a9c9bb1afb (Mono JIT Code) [NetworkManager.cs:2218] NetworkManager/<ReAuthUser>d__234:MoveNext () 
0x000002a8b8ac9ab2 (Mono JIT Code) System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start<TStateMachine_REF> (TStateMachine_REF&)
0x000002a9c9bb14ab (Mono JIT Code) NetworkManager:ReAuthUser ()

There have been no changes to our auth code, the only change has been updating Firebase while integrating Firebase Messaging. There is clearly something broken here, please re-open.

@firebase firebase locked and limited conversation to collaborators Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: core closed-by-bot needs-info Need information for the developer stale Don't have recent activity type: question unity-editor Issues related to Firebase usage in Unity editor
Projects
None yet
Development

No branches or pull requests

6 participants