question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Firestore Internal Error (21.1.1)

See original GitHub issue

[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:

  • For general technical questions, post a question on StackOverflow with the firebase tag.
  • For general Firebase discussion, use the firebase-talk google group.
  • For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 3.5
  • Firebase Component: Firestore (Database, Firestore, Storage, Functions, etc)
  • Component version: 21.1.1

[REQUIRED] Step 3: Describe the problem

Firestore is crashing sporadically in production. I’m seeing the following stack traces together in Crashlytics.

Fatal Exception: java.lang.RuntimeException: Internal error in Cloud Firestore (21.1.1).
       at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(AsyncQueue.java:529)
       at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(AsyncQueue.java:2000)
       at android.os.Handler.handleCallback(Handler.java:873)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:214)
       at android.app.ActivityThread.main(ActivityThread.java:7073)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
com.google.firebase.firestore.core.SyncEngine.handleCredentialChange (SyncEngine.java:599)
com.google.firebase.firestore.core.FirestoreClient.lambda$new$0 (FirestoreClient.java:105)
com.google.firebase.firestore.core.FirestoreClient$$Lambda$15.run (FirestoreClient.java:3599)
com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$2 (AsyncQueue.java:431)
com.google.firebase.firestore.util.AsyncQueue$$Lambda$2.call (AsyncQueue.java:2000)
com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1 (AsyncQueue.java:317)
com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$Lambda$2.run (AsyncQueue.java:2317)
java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:459)
java.util.concurrent.FutureTask.run (FutureTask.java:266)
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:301)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run (AsyncQueue.java:224)
java.lang.Thread.run (Thread.java:764)

Steps to reproduce:

This is happening in production and being reported back to my via Crashlytics.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
schmidt-sebastiancommented, Oct 15, 2019

@MattSkala Thanks for the hint with BroadcastReceiver. Fix for this NPE is coming.

0reactions
MattSkalacommented, Oct 12, 2019

We have been seeing similar crashes in production for several months now. If it helps, it seems that all of them happen when the app is launched in background using BroadcastReceiver. We are considering to deploy the app with de-obfuscated Firestore classes in the next release, so we can get a better stack trace.

For now, my guess is that user or syncEngine is null here:

https://github.com/firebase/firebase-android-sdk/blob/9ce9c184263d8a48ce0da26e70920650a6c95d84/firebase-firestore/src/main/java/com/google/firebase/firestore/core/FirestoreClient.java#L107-L108

Fatal Exception: java.lang.RuntimeException: Internal error in Cloud Firestore (21.1.1).
       at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(AsyncQueue.java:529)
       at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(AsyncQueue.java:2)
       at android.os.Handler.handleCallback(Handler.java:790)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:7000)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

Caused by java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.firebase.firestore.i0.m0.a(com.google.firebase.firestore.h0.f)' on a null object reference
       at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(AsyncQueue.java:320)
       at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$Lambda$2.run(AsyncQueue.java:4)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
       at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:224)
       at java.lang.Thread.run(Thread.java:764)

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.firebase.firestore.i0.m0.a(com.google.firebase.firestore.h0.f)' on a null object reference
       at com.google.firebase.firestore.core.FirestoreClient.lambda$new$0(FirestoreClient.java:105)
       at com.google.firebase.firestore.core.FirestoreClient$$Lambda$15.run(FirestoreClient.java:4)
       at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$2(AsyncQueue.java:431)
       at com.google.firebase.firestore.util.AsyncQueue$$Lambda$2.call(AsyncQueue.java:2)
       at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(AsyncQueue.java:317)
       at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$Lambda$2.run(AsyncQueue.java:4)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
       at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:224)
       at java.lang.Thread.run(Thread.java:764)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Internal error in Cloud Firestore on API 23 - Stack Overflow
The error occurs when I try to fetch a document from Firebase java.lang.RuntimeException: Internal error in Cloud Firestore (24.3.0). at ...
Read more >
Firebase Android SDK Release Notes - Google
Internal changes to ensure functionality alignment with other SDK releases. ... Firestore listeners to stop working and receive a Permission Denied error.
Read more >
java.lang.runtimeexception: internal error in cloud firestore ...
As for my env: Flutter (Channel stable, 3.3.9, on macOS 12.6 21G115 darwin-x64, locale en-JP). I upgraded firebase related packages using the same...
Read more >
java.lang.RuntimeException Internal error in Firestore (0.6.6 ...
You received this message because you are subscribed to the Google Groups "google-cloud-firestore-discuss" group. To unsubscribe from this group and stop ...
Read more >
Release Notes - Play services - Google Developers
Firebase Android BoM (Bill of Materials); Cloud Firestore; Cloud Functions for Firebase ... com.google.android.gms:play-services-measurement-sdk-api:21.1.1 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found