这是indexloc提供的服务,不要输入任何密码
Skip to content

[Firestore] SQLite error: Cannot perform this operation because there is no current transaction #115

@DavidSerr

Description

@DavidSerr

Environment

Android Studio version: 3.2.1
Firebase Component: Firestore
Component version: 17.1.2

Problem

Steps to reproduce:

Almost immediately, when connected to firestore realtime events, we get this:

2018-11-06 11:00:33.924 18673-18673 E/AndroidRuntime: FATAL EXCEPTION: main
    Process:, PID: 18673
    java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev).
        at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$5(com.google.firebase:firebase-firestore@@17.1.2:377)
        at com.google.firebase.firestore.util.AsyncQueue$$Lambda$5.run(Unknown Source:2)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6944)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
     Caused by: java.lang.IllegalStateException: Cannot perform this operation because there is no current transaction.
        at android.database.sqlite.SQLiteSession.throwIfNoTransaction(SQLiteSession.java:925)
        at android.database.sqlite.SQLiteSession.endTransaction(SQLiteSession.java:398)
        at android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java:683)
        at com.google.firebase.firestore.local.SQLitePersistence.runTransaction(com.google.firebase:firebase-firestore@@17.1.2:172)
        at com.google.firebase.firestore.local.LocalStore.applyRemoteEvent(com.google.firebase:firebase-firestore@@17.1.2:273)
        at com.google.firebase.firestore.core.SyncEngine.handleRemoteEvent(com.google.firebase:firebase-firestore@@17.1.2:315)
        at com.google.firebase.firestore.core.FirestoreClient.handleRemoteEvent(com.google.firebase:firebase-firestore@@17.1.2:230)
        at com.google.firebase.firestore.remote.RemoteStore.raiseWatchSnapshot(com.google.firebase:firebase-firestore@@17.1.2:511)
        at com.google.firebase.firestore.remote.RemoteStore.handleWatchChange(com.google.firebase:firebase-firestore@@17.1.2:420)
        at com.google.firebase.firestore.remote.RemoteStore.access$100(com.google.firebase:firebase-firestore@@17.1.2:52)
        at com.google.firebase.firestore.remote.RemoteStore$1.onWatchChange(com.google.firebase:firebase-firestore@@17.1.2:172)
        at com.google.firebase.firestore.remote.WatchStream.onNext(com.google.firebase:firebase-firestore@@17.1.2:109)
        at com.google.firebase.firestore.remote.WatchStream.onNext(com.google.firebase:firebase-firestore@@17.1.2:39)
        at com.google.firebase.firestore.remote.AbstractStream$StreamObserver.lambda$onNext$1(com.google.firebase:firebase-firestore@@17.1.2:117)
        at com.google.firebase.firestore.remote.AbstractStream$StreamObserver$$Lambda$2.run(Unknown Source:4)
        at com.google.firebase.firestore.remote.AbstractStream$CloseGuardedRunner.run(com.google.firebase:firebase-firestore@@17.1.2:67)
        at com.google.firebase.firestore.remote.AbstractStream$StreamObserver.onNext(com.google.firebase:firebase-firestore@@17.1.2:110)
        at com.google.firebase.firestore.util.FirestoreChannel$1.onMessage(com.google.firebase:firebase-firestore@@17.1.2:107)
        at io.grpc.ForwardingClientCallListener.onMessage(ForwardingClientCallListener.java:33)
        at io.grpc.ForwardingClientCallListener.onMessage(ForwardingClientCallListener.java:33)
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInContext(ClientCallImpl.java:526)
        at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
        at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
        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$DelayedStartFactory.run(com.google.firebase:firebase-firestore@@17.1.2:203)
        at java.lang.Thread.run(Thread.java:        

We have been researching about the issue related with the internal error on firestore module related with SQLite but we found nothing (just clear data on the application each time we restart the app). Our first option to tackle the problem was problably have multiple instances of firestore but this was not the case.

We are trying other options, but at the moment to avoid the crash we disable the persistence through the following code:

firestore.firestoreSettings = FirebaseFirestoreSettings.Builder().setPersistenceEnabled(false).build()

Could you help us with the issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions