firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.27k stars 574 forks source link

firebase-auth22.0.0: com.google.firebase.auth.internal.zzt.zzb() NullPointerException #5148

Closed 9468lgy closed 1 year ago

9468lgy commented 1 year ago

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository. If you have a general question, need help debugging, or fall into some other category use one of these other channels:

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

After I upgraded the auth sdk to 22.0.0, the firebase background detected that some users crashed

Steps to reproduce:

There is no recurrence, but I checked that there is a try catch operation in the sdk, I don’t know why there is still a crash 2242432577

Relevant Code:

Fatal Exception: com.google.android.gms.internal.firebase-auth-api.zzvz: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.firebase.auth.internal.zzt.zzb()' on a null object reference
       at com.google.firebase.auth.internal.zzbt.zzd(com.google.firebase:firebase-auth@@22.0.0:32)
       at com.google.firebase.auth.FirebaseAuth.zzS(com.google.firebase:firebase-auth@@22.0.0:14)
       at com.google.firebase.auth.zzw.zza(com.google.firebase:firebase-auth@@22.0.0:1)
       at com.google.android.gms.internal.firebase-auth-api.zzyr.zzb(com.google.firebase:firebase-auth@@22.0.0:3)
       at com.google.android.gms.internal.firebase-auth-api.zzabg.zzj(com.google.firebase:firebase-auth@@22.0.0:1)
       at com.google.android.gms.internal.firebase-auth-api.zzabd.zzp(com.google.firebase:firebase-auth@@22.0.0:2)
       at com.google.android.gms.internal.firebase-auth-api.zzaae.zzp(com.google.firebase:firebase-auth@@22.0.0:1)
       at com.google.android.gms.internal.firebase-auth-api.zzwy.zzb(com.google.firebase:firebase-auth@@22.0.0:2)
       at com.google.android.gms.internal.firebase-auth-api.zzabo.zzc(com.google.firebase:firebase-auth@@22.0.0:12)
       at com.google.android.gms.internal.firebase-auth-api.zzabo.zzb(com.google.firebase:firebase-auth@@22.0.0:14)
       at com.google.android.gms.internal.firebase-auth-api.zzaat.zzd(com.google.firebase:firebase-auth@@22.0.0:4)
       at com.google.android.gms.internal.firebase-auth-api.zzyh.zzn(com.google.firebase:firebase-auth@@22.0.0:4)
       at com.google.android.gms.internal.firebase-auth-api.zzaaf.zzj(com.google.firebase:firebase-auth@@22.0.0:3)
       at com.google.android.gms.internal.firebase-auth-api.zzyr.zzc(com.google.firebase:firebase-auth@@22.0.0:1)
       at com.google.android.gms.internal.firebase-auth-api.zzabh.run(com.google.firebase:firebase-auth@@22.0.0:1)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
       at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0(CustomThreadFactory.java:47)
       at java.lang.Thread.run(Thread.java:1012)
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.

argzdev commented 1 year ago

Hi @9468lgy, thanks for reaching out. You've mentioned that there's no recurrence, do you mean that this issue happens only once for the users that have encountered this? Also could you share some code snippets related to Firebase Authentication? I'm wondering which call from the SDK is causing the issue.

Also what was the previous version were you using? Thanks!

9468lgy commented 1 year ago

Hi @9468lgy, thanks for reaching out. You've mentioned that there's no recurrence, do you mean that this issue happens only once for the users that have encountered this? Also could you share some code snippets related to Firebase Authentication? I'm wondering which call from the SDK is causing the issue.

Also what was the previous version were you using? Thanks!

At present, we have 2 users with this crash, one user with 1 occurrence, and another user with 2 occurrences. According to the Firebase log, the crash occurred as soon as the user entered the App.

argzdev commented 1 year ago

Could you share with me the following details:

  1. What was the previous version you were using before encountering this issue?
  2. Can you share code snippets you've used in relation to Firebase Authentication?
  3. Are you able to reproduce this behavior?

These details will help us investigate this further, thanks!

9468lgy commented 1 year ago

Could you share with me the following details:

  1. What was the previous version you were using before encountering this issue?
  2. Can you share code snippets you've used in relation to Firebase Authentication?
  3. Are you able to reproduce this behavior?

These details will help us investigate this further, thanks!

1 The version we were using before was: com.google.firebase:firebase-auth:21.1.0 2 Our auth usage process relies on https://github.com/firebase/FirebaseUI-Android/tree/master/auth to build, adding some UI extensions, but the specific usage logic is no different from SDK we did not reproduce

AuthMethodPickerLayout customLayout = new AuthMethodPickerLayout
                .Builder(R.layout.activity_fauth_login_custom)
                .setGoogleButtonId(R.id.btn_google)
                .setEmailButtonId(R.id.btn_email)
                .setFacebookButtonId(R.id.btn_facebook)
                .setTosAndPrivacyPolicyId(R.id.main_tos_and_pp)
                .setLineButtonId(R.id.btn_line)
                .build();

startActivityForResult(
                AuthUI.getInstance()
                        .createSignInIntentBuilder()
                        .setAvailableProviders(getAvailableProviders())
                        .setLogo(R.mipmap.ic_launcher)
                        .setLastMail(UsersManager.getInstance().getLastEmail())
                        .setIdpIndex(UsersManager.getInstance().getIdpIndexInt())
                        .setIsSmartLockEnabled(false)
                        .setTosAndPrivacyPolicyUrls(getSelectedTosUrl(),
                                getSelectedPrivacyPolicyUrl())
                        .setAuthMethodPickerLayout(customLayout)
                        .setTheme(R.style.immersive_theme)
                        .build(),
                RC_SIGN_IN);

3 we did not reproduce

argzdev commented 1 year ago

Hi @9468lgy, sorry for the radio silence here. Our engineers have tried investigating this further, and after obfuscating the stack trace. It shows that the error is due to a failure turning the FirebaseUser with a supposed String parameter but has a null parameter as a json object, however this is unclear which field and how it is receiving a null value. I also noticed that FirebaseUI is using an old version of BoM version 28.2.0, current latest version is 32.2.0. Equivalent version of this in Firebase Auth is: 21.0.1, and 22.1.0, respectively.

argzdev commented 1 year ago

Just an update, our engineers are already working to updating the FirebaseUI. We can wait for the latest version release, and see if that fixes the issue. I'll leave this open for now.

MarjanaKarzek commented 1 year ago

@argzdev we are experiencing the same issue in our application. since the update 22.0.0 we are observing the same crash report. We are not able to trace back specifically to where the crash occurs and weren't able to reproduce the issue.

slavinsky-dev commented 1 year ago

Just leave stack trace here, may be it helps someone

Still receive crash reports 4 users for last 4 days from 3500 DAU

firebase-bom:32.1.1 firebase-auth:22.1.1

com.google.firebase.auth.internal.zzbt.zzd

Fatal Exception: com.google.android.gms.internal.firebase-auth-api.zzwk: java.lang.ArrayIndexOutOfBoundsException: length=2; index=-1
       at com.google.firebase.auth.internal.zzbt.zzd(com.google.firebase:firebase-auth@@22.1.1:38)
       at com.google.firebase.auth.FirebaseAuth.zzT(com.google.firebase:firebase-auth@@22.1.1:14)
       at com.google.firebase.auth.zzx.zza(com.google.firebase:firebase-auth@@22.1.1:1)
       at com.google.android.gms.internal.firebase-auth-api.zzzc.zzb(com.google.firebase:firebase-auth@@22.1.1:3)
       at com.google.android.gms.internal.firebase-auth-api.zzabs.zzj(com.google.firebase:firebase-auth@@22.1.1:1)
       at com.google.android.gms.internal.firebase-auth-api.zzabp.zzq(com.google.firebase:firebase-auth@@22.1.1:2)
       at com.google.android.gms.internal.firebase-auth-api.zzaaq.zzq(com.google.firebase:firebase-auth@@22.1.1:1)
       at com.google.android.gms.internal.firebase-auth-api.zzxj.zzb(com.google.firebase:firebase-auth@@22.1.1:2)
       at com.google.android.gms.internal.firebase-auth-api.zzaca.zzc(com.google.firebase:firebase-auth@@22.1.1:12)
       at com.google.android.gms.internal.firebase-auth-api.zzaca.zzb(com.google.firebase:firebase-auth@@22.1.1:14)
       at com.google.android.gms.internal.firebase-auth-api.zzabf.zzf(com.google.firebase:firebase-auth@@22.1.1:4)
       at com.google.android.gms.internal.firebase-auth-api.zzys.zzp(com.google.firebase:firebase-auth@@22.1.1:4)
       at com.google.android.gms.internal.firebase-auth-api.zzaar.zzj(com.google.firebase:firebase-auth@@22.1.1:3)
       at com.google.android.gms.internal.firebase-auth-api.zzzc.zzc(com.google.firebase:firebase-auth@@22.1.1:1)
       at com.google.android.gms.internal.firebase-auth-api.zzabt.run(com.google.firebase:firebase-auth@@22.1.1:1)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0$com-google-firebase-concurrent-CustomThreadFactory(CustomThreadFactory.java:47)
       at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(:4)
       at java.lang.Thread.run(Thread.java:920)
Caused by java.lang.ArrayIndexOutOfBoundsException: length=2; index=-1
       at java.util.ArrayList.get(ArrayList.java:439)
       at com.google.firebase.auth.internal.zzbt.zzd(com.google.firebase:firebase-auth@@22.1.1:19)
       at com.google.firebase.auth.FirebaseAuth.zzT(com.google.firebase:firebase-auth@@22.1.1:14)
       at com.google.firebase.auth.zzx.zza(com.google.firebase:firebase-auth@@22.1.1:1)
       at com.google.android.gms.internal.firebase-auth-api.zzzc.zzb(com.google.firebase:firebase-auth@@22.1.1:3)
       at com.google.android.gms.internal.firebase-auth-api.zzabs.zzj(com.google.firebase:firebase-auth@@22.1.1:1)
       at com.google.android.gms.internal.firebase-auth-api.zzabp.zzq(com.google.firebase:firebase-auth@@22.1.1:2)
       at com.google.android.gms.internal.firebase-auth-api.zzaaq.zzq(com.google.firebase:firebase-auth@@22.1.1:1)
       at com.google.android.gms.internal.firebase-auth-api.zzxj.zzb(com.google.firebase:firebase-auth@@22.1.1:2)
       at com.google.android.gms.internal.firebase-auth-api.zzaca.zzc(com.google.firebase:firebase-auth@@22.1.1:12)
       at com.google.android.gms.internal.firebase-auth-api.zzaca.zzb(com.google.firebase:firebase-auth@@22.1.1:14)
       at com.google.android.gms.internal.firebase-auth-api.zzabf.zzf(com.google.firebase:firebase-auth@@22.1.1:4)
       at com.google.android.gms.internal.firebase-auth-api.zzys.zzp(com.google.firebase:firebase-auth@@22.1.1:4)
       at com.google.android.gms.internal.firebase-auth-api.zzaar.zzj(com.google.firebase:firebase-auth@@22.1.1:3)
       at com.google.android.gms.internal.firebase-auth-api.zzzc.zzc(com.google.firebase:firebase-auth@@22.1.1:1)
       at com.google.android.gms.internal.firebase-auth-api.zzabt.run(com.google.firebase:firebase-auth@@22.1.1:1)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0$com-google-firebase-concurrent-CustomThreadFactory(CustomThreadFactory.java:47)
       at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(:4)
       at java.lang.Thread.run(Thread.java:920)
argzdev commented 1 year ago

Thanks for all the extra details folks, since the issue still seems to be occuring in version 22.1.1, we'll collate the reports in #5311, please do leave a thumbs up on the author's post in #5311 so we can properly track the severity and demand of the issue. Thanks!