firebase-android-sdk: IllegalStateException in FirebaseInstanceId

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Tried on both 3.6.3 and 4.0.0-beta05
  • Firebase Component: Firebase IID (via messaging or installations
  • Component version: We have direct deps on:
FIREBASE_ANALYTICS = "17.3.0"
FIREBASE_MESSAGING = "20.1.5"
FIREBASE_PERF = "19.0.6"
FIREBASE_CRASHLYTICS = "17.0.0-beta04"

Firebase installations resolves to 16.2.1

[REQUIRED] Step 3: Describe the problem

We have a significant number of crash reports in crashlytics with this obfuscated stack trace:

Fatal Exception: java.lang.IllegalStateException
       at com.google.firebase.iid.FirebaseInstanceId.zzl(FirebaseInstanceId.java:70)
       at com.google.firebase.iid.FirebaseInstanceId.getId(FirebaseInstanceId.java:48)
       at com.google.firebase.perf.internal.zzf.zzbv(zzf.java:181)
       at com.google.firebase.perf.internal.zzf.zzbu(zzf.java:44)
       at com.google.firebase.perf.internal.zzf.zzc(zzf.java:195)
       at com.google.firebase.perf.internal.zze.run(zze.java:2)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:919)

This is currently by far our largest open crash cluster

It is very similar to https://github.com/firebase/firebase-android-sdk/issues/1339#, but I was advised by @TKBurner to create a new ticket since that was was marked closed in an older sdk version. I’m happy to provide any additional data that might help here.

Steps to reproduce:

We don’t have a local repro for this issue, but it’s certainly affecting people in the wild.

cc @andirayo who worked on the original issue

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 39 (23 by maintainers)

Most upvoted comments

@quibi-jlk We will immediately be looking into this, but we cannot promise you any timeline. The next scheduled release will be FirebaseInstanceId (and FirebaseMessaging) v20.1.8, scheduled for May 21, 2020.

Thus, if this is an urgent issue for you, I recommend you to downgrade to versions of Firebase SDKs before the introduction of the infrastructure service FirebaseInstallations:

You can lock FirebaseInstanceId to v20.0.2 or use older versions of Firebase SDKs (which should have the same effect):

  • FirebaseMessaging < v20.1.1
  • Analytics < 17.4.0
  • FirePerf < 19.0.7
  • Crashlytics < 17.0.0

For developers impacted by this issue, please try & update to the latest version of Fireperf - 19.0.8 released on July 17, 2020. The latest version contains a possible fix to the IllegalStateException.

Also, please report your findings on this issue after the Fireperf update.

@ankitaj224 Thanks for checking this out. Currently I’m not seeing this crash any more and it’d be hard to debug, so I won’t report this for now. Thanks once again.

Thanks, @ankitaj224, that’s a super interesting theory and sounds plausible to me! We don’t call FirebaseInstanceId.getId() a ton in our app (never in the background), but we do actually call it on occasion during normal app usage. We do use Firebase Perf, so this definitely sounds like a possible cause. Thanks for your persistence on this 😃.

@quibi-jlk That sounds like a possibility. Thanks for the suggestion 👍 , I ll test my app in Doze and Standby mode to see if I can reproduce this crash. I will keep you posted on how that test goes.

For mine, got multiple projects. As for crashes, 51% Android 10, 39% Android 9. 80% in background.

But for my app, the last crash was on 4th June 2020. My app only has around 40k+ active users.

As far as I can tell, it seems fairly aligned with our overall distribution in terms of manufacturer, os version, etc.

Attaching file with all 40 threads @ankitaj224 allthreadsfirebase.log

@quibi-jlk I deobfuscated the your stacktrace and it is either v20.1.4 or v20.1.5 of FirebaseInstanceId. Those versions contain the original fix. You name FIS version as 16.2.1 which should also contain the fix.

For some reason, other than you only @hetang reported a similar issue. On the other hand, your comment in #1339 immediately got 3 upvotes.

Apparently we have a regression of #1339 (or #1355 did not fix all scenarios).