You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting a lot of reports about this issue in Crashlytics. I couldn't reproduce it locally yet.
Version
3.2.0
Description
Non-fatal Exception: android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5 SQLITE_BUSY[5])
at android.database.sqlite.SQLiteConnection.nativeExecute(SQLiteConnection.java)
at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:867)
at android.database.sqlite.SQLiteSession.beginTransactionUnchecked(SQLiteSession.java:321)
at android.database.sqlite.SQLiteSession.beginTransaction(SQLiteSession.java:300)
at android.database.sqlite.SQLiteDatabase.beginTransaction(SQLiteDatabase.java:766)
at android.database.sqlite.SQLiteDatabase.beginTransactionNonExclusive(SQLiteDatabase.java:700)
at androidx.sqlite.db.framework.FrameworkSQLiteDatabase.beginTransactionNonExclusive(FrameworkSQLiteDatabase.java:74)
at com.squareup.sqldelight.android.AndroidSqliteDriver.newTransaction(AndroidSqliteDriver.kt:88)
at com.squareup.sqldelight.TransacterImpl.transactionWithWrapper(Transacter.kt:225)
at com.squareup.sqldelight.TransacterImpl.transaction(Transacter.kt:214)
at com.squareup.sqldelight.Transacter$DefaultImpls.transaction$default(Transacter.kt:72)
at com.apollographql.apollo3.cache.normalized.sql.internal.CacheQueriesHelpers.updateRecord(CacheQueriesHelpers.java:66)
at com.apollographql.apollo3.cache.normalized.sql.SqlNormalizedCache.merge(SqlNormalizedCache.kt:82)
at com.apollographql.apollo3.cache.normalized.api.MemoryCache.merge(MemoryCache.kt:113)
at com.apollographql.apollo3.cache.normalized.api.MemoryCache.merge(MemoryCache.kt:120)
at com.apollographql.apollo3.cache.normalized.api.internal.OptimisticCache.merge(OptimisticCache.kt:38)
at com.apollographql.apollo3.cache.normalized.internal.DefaultApolloStore$writeOperationWithRecords$2.invoke(DefaultApolloStore.kt:205)
at com.apollographql.apollo3.cache.normalized.internal.DefaultApolloStore$writeOperationWithRecords$2.invoke(DefaultApolloStore.kt:198)
at com.apollographql.apollo3.cache.normalized.internal.Guard.writeAccess(Guard.java:18)
at com.apollographql.apollo3.cache.normalized.internal.DefaultApolloStore.writeOperationWithRecords(DefaultApolloStore.kt:198)
at com.apollographql.apollo3.cache.normalized.internal.DefaultApolloStore.writeOperation(DefaultApolloStore.kt:149)
at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor$maybeWriteToCache$2.invokeSuspend(ApolloCacheInterceptor.kt:67)
at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor$maybeWriteToCache$2.invoke(ApolloCacheInterceptor.kt:2)
at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor.maybeAsync(ApolloCacheInterceptor.kt:45)
at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor.maybeWriteToCache(ApolloCacheInterceptor.kt:65)
at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor.maybeWriteToCache$default(ApolloCacheInterceptor.kt:52)
at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor$readFromNetwork$networkResponse$1.invokeSuspend(ApolloCacheInterceptor.kt:211)
at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor$readFromNetwork$networkResponse$1.invoke(ApolloCacheInterceptor.kt:2)
at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit(Collect.kt:136)
at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:77)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:59)
at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1$invokeSuspend$$inlined$map$1$2.emit(Collect.kt:174)
at kotlinx.coroutines.flow.FlowKt__BuildersKt$flowOf$$inlined$unsafeFlow$2.collect(SafeCollector.common.kt:113)
at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1$invokeSuspend$$inlined$map$1.collect(HttpNetworkTransport.java:114)
at kotlinx.coroutines.flow.FlowKt__CollectKt.emitAll(FlowKt__CollectKt.java:132)
at kotlinx.coroutines.flow.FlowKt.emitAll(FlowKt.java:1)
at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1.invokeSuspend(HttpNetworkTransport.kt:87)
at com.apollographql.apollo3.network.http.HttpNetworkTransport$execute$1.invoke(HttpNetworkTransport.kt:2)
at kotlinx.coroutines.flow.SafeFlow.collectSafely(SafeFlow.java:61)
at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:212)
at kotlinx.coroutines.flow.internal.ChannelFlowOperatorImpl.flowCollect(ChannelFlow.kt:195)
at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collect$suspendImpl(ChannelFlow.kt:167)
at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collect(ChannelFlow.kt:5)
at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1.collect(SafeCollector.common.kt:114)
at kotlinx.coroutines.flow.FlowKt__ReduceKt.single(FlowKt__ReduceKt.java:179)
at kotlinx.coroutines.flow.FlowKt.single(FlowKt.java:1)
at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor.readFromNetwork(ApolloCacheInterceptor.kt:212)
at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor.access$readFromNetwork(ApolloCacheInterceptor.kt:31)
at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor$interceptQuery$1.invokeSuspend(ApolloCacheInterceptor.kt:168)
at com.apollographql.apollo3.cache.normalized.internal.ApolloCacheInterceptor$interceptQuery$1.invoke(ApolloCacheInterceptor.kt:1)
at kotlinx.coroutines.flow.SafeFlow.collectSafely(SafeFlow.java:61)
at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:212)
at kotlinx.coroutines.flow.internal.ChannelFlowOperatorImpl.flowCollect(ChannelFlow.kt:195)
at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collect$suspendImpl(ChannelFlow.kt:167)
at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collect(ChannelFlow.kt:5)
at kotlinx.coroutines.flow.FlowKt__ReduceKt.single(FlowKt__ReduceKt.java:179)
at kotlinx.coroutines.flow.FlowKt.single(FlowKt.java:1)
at com.apollographql.apollo3.ApolloCall.execute(ApolloCall.java:102)
at ai.moises.data.service.remote.user.UserRemoteServiceImpl$getCurrentUser$2.invokeSuspend(UserRemoteServiceImpl.kt:35)
at ai.moises.data.service.remote.user.UserRemoteServiceImpl$getCurrentUser$2.invoke(UserRemoteServiceImpl.kt:2)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(UndispatchedKt.java:89)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(BuildersKt__Builders_commonKt.java:165)
at kotlinx.coroutines.BuildersKt.withContext(BuildersKt.java:1)
at ai.moises.data.service.remote.user.UserRemoteServiceImpl.getCurrentUser(UserRemoteServiceImpl.kt:31)
at ai.moises.data.repository.userrepository.UserRemoteDataSourceImpl$getCurrentUser$2.invokeSuspend(UserRemoteDataSourceImpl.kt:22)
at ai.moises.data.repository.userrepository.UserRemoteDataSourceImpl$getCurrentUser$2.invoke(UserRemoteDataSourceImpl.kt:2)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(UndispatchedKt.java:89)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(BuildersKt__Builders_commonKt.java:165)
at kotlinx.coroutines.BuildersKt.withContext(BuildersKt.java:1)
at ai.moises.data.repository.userrepository.UserRemoteDataSourceImpl.getCurrentUser(UserRemoteDataSourceImpl.kt:21)
at ai.moises.data.repository.userrepository.UserRepositoryImpl$refreshUser$2.invokeSuspend(UserRepositoryImpl.kt:153)
at ai.moises.data.repository.userrepository.UserRepositoryImpl$refreshUser$2.invoke(UserRepositoryImpl.kt:2)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(UndispatchedKt.java:89)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(BuildersKt__Builders_commonKt.java:165)
at kotlinx.coroutines.BuildersKt.withContext(BuildersKt.java:1)
at ai.moises.data.repository.userrepository.UserRepositoryImpl.refreshUser(UserRepositoryImpl.kt:142)
at ai.moises.data.repository.userrepository.UserRepository$DefaultImpls.refreshUser$default(UserRepository.kt:20)
at ai.moises.data.repository.userrepository.UserRepositoryImpl$getCurrentUserAsFlow$2$1.invokeSuspend(UserRepositoryImpl.kt:48)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
The text was updated successfully, but these errors were encountered:
The database is locked with a per-client lock so one thing that could explain this is if you have multiple ApolloClients using the same SQLite database?
If not then it might be something else although not 100% sure what. Cache improvements are next on the roadmap so I'll take this opportunity to revisit locking and see what could potentially cause this.
In the meantime, you can also upgrade to 3.2.1+ that has exception handlers that will allow you to log/investigate these a bit more instead of crashing (although your stacktrace mentions "non-fatal" so could it be that it's silently ignored already?).
I'm using a single ApolloClient. I've already released a new version using version 3.2.2, because of #4072 . I'm still waiting for the full release to see if I can get more details on these issues.
Summary
I'm getting a lot of reports about this issue in Crashlytics. I couldn't reproduce it locally yet.
Version
3.2.0
Description
The text was updated successfully, but these errors were encountered: