Firestore AsyncQueue/SQLiteRemoteDocumentCache Crash
[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: Android Studio Otter | 2025.2.1 Patch 1 (Build #AI-252.25557.131.2521.14432022)
- Firebase Component: Firestore
- Component version: 26.0.2 (via BoM 34.6.0)
[REQUIRED] Step 3: Describe the problem
The app crashes with a RuntimeException wrapping a SQLiteException ("Native could not create new byte[]") originating from SQLiteRemoteDocumentCache.
Steps to reproduce:
I cannot reproduce this deterministically, but it occurs during normal application usage while the Firestore SDK is heavily syncing data in the background.
Relevant Code:
2025-12-01 17:47:38.742 32449-32449 AndroidRuntime com.myapp E FATAL EXCEPTION: main (Ask Gemini)
Process: com.myapp, PID: 32449
java.lang.RuntimeException: Internal error in Cloud Firestore (26.0.2).
at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(AsyncQueue.java:546)
at com.google.firebase.firestore.util.AsyncQueue$$ExternalSyntheticLambda3.run(D8$$SyntheticClass:0)
at android.os.Handler.handleCallback(Handler.java:995)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loopOnce(Looper.java:273)
at android.os.Looper.loop(Looper.java:363)
at android.app.ActivityThread.main(ActivityThread.java:10060)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:632)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
Caused by: android.database.sqlite.SQLiteException: unknown error (code 0 SQLITE_OK[0]): Native could not create new byte[]
at android.database.CursorWindow.nativeGetBlob(Native Method)
at android.database.CursorWindow.getBlob(CursorWindow.java:475)
at android.database.AbstractWindowedCursor.getBlob(AbstractWindowedCursor.java:48)
at com.google.firebase.firestore.local.SQLiteRemoteDocumentCache.processRowInBackground(SQLiteRemoteDocumentCache.java:303)
at com.google.firebase.firestore.local.SQLiteRemoteDocumentCache.lambda$getAll$0$com-google-firebase-firestore-local-SQLiteRemoteDocumentCache(SQLiteRemoteDocumentCache.java:175)
at com.google.firebase.firestore.local.SQLiteRemoteDocumentCache$$ExternalSyntheticLambda2.accept(D8$$SyntheticClass:0)
at com.google.firebase.firestore.local.SQLitePersistence$Query.forEach(SQLitePersistence.java:500)
at com.google.firebase.firestore.local.SQLiteRemoteDocumentCache.getAll(SQLiteRemoteDocumentCache.java:175)
at com.google.firebase.firestore.local.LocalStore.populateDocumentChanges(LocalStore.java:518)
at com.google.firebase.firestore.local.LocalStore.lambda$applyRemoteEvent$6$com-google-firebase-firestore-local-LocalStore(LocalStore.java:469)
at com.google.firebase.firestore.local.LocalStore$$ExternalSyntheticLambda14.get(D8$$SyntheticClass:0)
at com.google.firebase.firestore.local.SQLitePersistence.runTransaction(SQLitePersistence.java:233)
at com.google.firebase.firestore.local.LocalStore.applyRemoteEvent(LocalStore.java:418)
at com.google.firebase.firestore.core.SyncEngine.handleRemoteEvent(SyncEngine.java:403)
at com.google.firebase.firestore.core.MemoryComponentProvider$RemoteStoreCallback.handleRemoteEvent(MemoryComponentProvider.java:120)
at com.google.firebase.firestore.remote.RemoteStore.raiseWatchSnapshot(RemoteStore.java:586)
at com.google.firebase.firestore.remote.RemoteStore.handleWatchChange(RemoteStore.java:497)
at com.google.firebase.firestore.remote.RemoteStore.access$100(RemoteStore.java:60)
at com.google.firebase.firestore.remote.RemoteStore$1.onWatchChange(RemoteStore.java:188)
at com.google.firebase.firestore.remote.WatchStream.onNext(WatchStream.java:114)
at com.google.firebase.firestore.remote.WatchStream.onNext(WatchStream.java:38)
at com.google.firebase.firestore.remote.AbstractStream$StreamObserver.lambda$onNext$1$com-google-firebase-firestore-remote-AbstractStream$StreamObserver(AbstractStream.java:126)
at com.google.firebase.firestore.remote.AbstractStream$StreamObserver$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
at com.google.firebase.firestore.remote.AbstractStream$CloseGuardedRunner.run(AbstractStream.java:67)
at com.google.firebase.firestore.remote.AbstractStream$StreamObserver.onNext(AbstractStream.java:113)
at com.google.firebase.firestore.remote.FirestoreChannel$1.onMessage(FirestoreChannel.java:162)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInternal(ClientCallImpl.java:667)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInContext(ClientCallImpl.java:654)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
This is effectively an "out of memory error" thrown by the Android SQLite native code here:
https://android.googlesource.com/platform/frameworks/base/+/31eb3c89a94d77eae9503bd635a4f056db3e3a31/core/jni/android_database_CursorWindow.cpp#227
Unfortunately, this error is too vague to investigate as there are, obviously, many things that could cause memory to become exhausted in an application. This is the first I've heard of an OOM error in the Firestore SDK so my instinct is that the root cause is not the Firestore SDK. That being said, I'm happy to investigate if you can provide more details, a sample database/query, or reproducible app. But without more information, I'm afraid there's not much we can do to help.
Hey @fanwgwg. 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!
Since there haven't been any recent updates here, I am going to close this issue.
@fanwgwg 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.