Skip to content

Crash in Firestore: IllegalStateException - call was cancelled #6883

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
AmrKhalilDH opened this issue Apr 15, 2025 · 1 comment · Fixed by #6894
Closed

Crash in Firestore: IllegalStateException - call was cancelled #6883

AmrKhalilDH opened this issue Apr 15, 2025 · 1 comment · Fixed by #6894
Assignees

Comments

@AmrKhalilDH
Copy link

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

Yes, this issue is a crash caused by firestore’s internal handling (likely related to gRPC streaming).


[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Meerkat | 2024.3.1
  • Firebase Component: firestore
  • Component version: firebase BoM version 33.4.0 (firestore resolved to 25.1.2)

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

  • The issue has been reported via crashlytics.
  • This crash happens randomly in production. It seems to occur during app initialization when firestore starts or stops listening to a collection.

Relevant Code

       Fatal Exception: java.lang.RuntimeException: Internal error in Cloud Firestore (25.1.2).
       at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(AsyncQueue.java:546)
       at android.os.Handler.handleCallback(Handler.java:900)
       at android.os.Handler.dispatchMessage(Handler.java:103)
       at android.os.Looper.loop(Looper.java:219)
       at android.app.ActivityThread.main(ActivityThread.java:8668)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
        

    Caused by java.lang.RuntimeException: java.lang.IllegalStateException: call was cancelled
       at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(AsyncQueue.java:333)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
       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:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:235)
       at java.lang.Thread.run(Thread.java:929)
       
        
   Caused by java.lang.IllegalStateException: call was cancelled
       at com.google.common.base.Preconditions.checkState(Preconditions.java:513)
       at io.grpc.internal.ClientCallImpl.halfCloseInternal(ClientCallImpl.java:500)
       at io.grpc.internal.ClientCallImpl.halfClose(ClientCallImpl.java:494)
       at io.grpc.internal.DelayedClientCall$7.run(DelayedClientCall.java:386)
       at io.grpc.internal.DelayedClientCall.delayOrExecute(DelayedClientCall.java:273)
       at io.grpc.internal.DelayedClientCall.halfClose(DelayedClientCall.java:383)
       at io.grpc.PartialForwardingClientCall.halfClose(PartialForwardingClientCall.java:44)
       at io.grpc.ForwardingClientCall.halfClose(ForwardingClientCall.java:22)
       at com.google.firebase.firestore.remote.FirestoreChannel$2.halfClose(FirestoreChannel.java:209)
       at com.google.firebase.firestore.remote.AbstractStream.close(AbstractStream.java:355)
       at com.google.firebase.firestore.remote.AbstractStream.stop(AbstractStream.java:377)
       at com.google.firebase.firestore.remote.WatchStream.stop(WatchStream.java:38)
       at com.google.firebase.firestore.remote.RemoteStore.disableNetworkInternal(RemoteStore.java:295)
       at com.google.firebase.firestore.remote.RemoteStore.restartNetwork(RemoteStore.java:308)
       at com.google.firebase.firestore.remote.RemoteStore.lambda$new$0(RemoteStore.java:251)
       at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$2(AsyncQueue.java:445)
       at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(AsyncQueue.java:330)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
       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:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:235)
       at java.lang.Thread.run(Thread.java:929)
@tom-andersen
Copy link
Contributor

This appears to be a benign error that should be caught and logged, rather than bringing the Firestore SDK into an error state. Thanks for the information!

I have created a PR to fix this, and will have the team review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants