Status Update
Comments
da...@google.com <da...@google.com> #2
Is there any updates? This is a big problem!
go...@lutraha.com <go...@lutraha.com> #3
Hi there - could you provide more context on the issue & a sample project to reproduce? Database locked exceptions are quite difficult to pinpoint without a repro project. Thanks!
on...@adastra.one <on...@adastra.one> #4
Hi. It is reproduceable on some users by using this code:
suspend fun <R> MyDatabase.workaroundWithTransaction(block: suspend TransactionScope<R>.() -> R) {
useWriterConnection {
it.immediateTransaction(block)
}
// TODO: Temporally fix https://issuetracker.google.com/issues/340606803#comment2
// Manually triggers invalidation
invalidationTracker.refreshAsync()
}
aq...@gmail.com <aq...@gmail.com> #6
Hi. Please merge the pull request. This is big problem!
da...@google.com <da...@google.com> #7
Hi. Is there any updates on this problem?
ap...@google.com <ap...@google.com> #8
Hi, I updated my version to alpha12 but still have these crashes. Please release a fix asap.
da...@google.com <da...@google.com>
da...@google.com <da...@google.com> #9
Will there be fixes released this Wednesday?
an...@gmail.com <an...@gmail.com> #10
Hey, there is no release on Wednesday (holiday in the USA)
We haven't found the root cause of this exception, it happens when SQLite can't commit the transaction because some other connection has a lock, we need more information, a sample project that reproduces the issue preferably, or more details on how the database is being used (is it from multiple process? is there heavy concurrency?).
You can also increase the time SQLite will wait before it error with 'database locked' by executing PRAGMA busy_timeout = <time in ms>
, the current default is 3000
da...@google.com <da...@google.com> #11
Thank you for you response.
- Isn't these pull request addressed this issue?
1.1
https://android-review.googlesource.com/c/platform/frameworks/support/+/3408679 1.2https://android-review.googlesource.com/c/platform/frameworks/support/+/3114928 - According to RoomDB documentation about
withTransaction
: "Room will only perform at most one transaction at a time, additional transactions are queued and executed on a first come, first serve order." So the transaction should just wait for other transaction to complete and not throw exception instead. Isn't it?
ap...@google.com <ap...@google.com> #12
I tried to use this code and still getting the same error from users. (deferredTransaction
instead of immediateTransaction
)
private val dbMutex = Mutex()
suspend fun <R> MyDatabse.workaroundWithTransaction(block: suspend TransactionScope<R>.() -> R) {
dbMutex.withLock {
useWriterConnection {
it.deferredTransaction(block)
}
// TODO: Fix https://issuetracker.google.com/issues/340606803#comment2
// Manually triggers invalidation
invalidationTracker.refreshAsync()
}
}
da...@google.com <da...@google.com>
na...@google.com <na...@google.com> #13
Moreover now I am also think that @Update
function caused particularly this crash. I will monitor the situation to this if this 1 crash or it will be more with the same reason.
Description
Version used: room 2.7.0-beta01, sqlite 2.5.0-beta01
Devices/Android versions reproduced on: iPhone 16 Pro (18.2)
The issue happens during the compilation. The app compiles for Android target, but it fails to compile for iOS simulator.
> Task :xxx:kspKotlinIosSimulatorArm64 FAILED
note: [ksp] loaded provider(s): [androidx.room.RoomKspProcessor$Provider]
error: [ksp] java.lang.NullPointerException: null cannot be cast to non-null type androidx.room.compiler.processing.XAnnotation
at androidx.room.compiler.processing.XAnnotationValue.asAnnotation(XAnnotationValue.kt:62)
at androidx.room.compiler.processing.XAnnotationValue.asAnnotationList(XAnnotationValue.kt:68)
at androidx.room.processor.EntityProcessor$Companion.extractIndices(EntityProcessor.kt:42)
at androidx.room.processor.TableEntityProcessor.doProcess(TableEntityProcessor.kt:85)
at androidx.room.processor.TableEntityProcessor.process$lambda$0(TableEntityProcessor.kt:54)
at androidx.room.processor.cache.Cache$Bucket.get(Cache.kt:48)
at androidx.room.processor.TableEntityProcessor.process(TableEntityProcessor.kt:54)
at androidx.room.processor.DatabaseProcessor.processEntities(DatabaseProcessor.kt:442)
at androidx.room.processor.DatabaseProcessor.doProcess(DatabaseProcessor.kt:68)
at androidx.room.processor.DatabaseProcessor.process(DatabaseProcessor.kt:59)
at androidx.room.DatabaseProcessingStep.process$lambda$2$lambda$1(DatabaseProcessingStep.kt:69)
at androidx.room.processor.Context.collectLogs(Context.kt:178)
at androidx.room.DatabaseProcessingStep.process(DatabaseProcessingStep.kt:68)
at androidx.room.compiler.processing.CommonProcessorDelegate.processRound(XBasicAnnotationProcessor.kt:134)
at androidx.room.compiler.processing.ksp.KspBasicAnnotationProcessor.process(KspBasicAnnotationProcessor.kt:62)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$8$1.invoke(KotlinSymbolProcessingExtension.kt:320)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$8$1.invoke(KotlinSymbolProcessingExtension.kt:318)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.handleException(KotlinSymbolProcessingExtension.kt:430)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.doAnalysis(KotlinSymbolProcessingExtension.kt:318)
at org.jetbrains.kotlin.backend.konan.TopDownAnalyzerFacadeForKonan.analyzeFilesWithGivenTrace(TopDownAnalyzerFacadeForKonan.kt:102)
at org.jetbrains.kotlin.backend.konan.TopDownAnalyzerFacadeForKonan.analyzeFiles(TopDownAnalyzerFacadeForKonan.kt:65)
at org.jetbrains.kotlin.backend.konan.driver.phases.FrontendKt.FrontendPhase$lambda$3$lambda$2(Frontend.kt:67)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:112)
at org.jetbrains.kotlin.backend.konan.driver.phases.FrontendKt.FrontendPhase$lambda$3(Frontend.kt:66)
at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$createSimpleNamedCompilerPhase$1.phaseBody(PhaseBuilders.kt:69)
at org.jetbrains.kotlin.backend.common.phaser.SimpleNamedCompilerPhase.phaseBody(CompilerPhase.kt:226)
at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedCompilerPhase.invoke(CompilerPhase.kt:113)
at org.jetbrains.kotlin.backend.konan.driver.PhaseEngine.runPhase(Machinery.kt:120)
at org.jetbrains.kotlin.backend.konan.driver.PhaseEngine.runPhase$default(Machinery.kt:111)
at org.jetbrains.kotlin.backend.konan.driver.phases.TopLevelPhasesKt.runFrontend(TopLevelPhases.kt:32)
at org.jetbrains.kotlin.backend.konan.driver.DynamicCompilerDriver.serializeKlibK1(DynamicCompilerDriver.kt:152)
at org.jetbrains.kotlin.backend.konan.driver.DynamicCompilerDriver.produceKlib(DynamicCompilerDriver.kt:113)
at org.jetbrains.kotlin.backend.konan.driver.DynamicCompilerDriver.run$lambda$2$lambda$1$lambda$0(DynamicCompilerDriver.kt:44)
at org.jetbrains.kotlin.backend.konan.driver.PhaseEngine$Companion$startTopLevel$topLevelPhase$1.phaseBody(Machinery.kt:79)
at org.jetbrains.kotlin.backend.konan.driver.PhaseEngine$Companion$startTopLevel$topLevelPhase$1.phaseBody(Machinery.kt:73)
at org.jetbrains.kotlin.backend.common.phaser.SimpleNamedCompilerPhase.phaseBody(CompilerPhase.kt:226)
at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedCompilerPhase.invoke(CompilerPhase.kt:113)
at org.jetbrains.kotlin.backend.konan.driver.PhaseEngine$Companion.startTopLevel(Machinery.kt:86)
at org.jetbrains.kotlin.backend.konan.driver.DynamicCompilerDriver.run(DynamicCompilerDriver.kt:37)
at org.jetbrains.kotlin.backend.konan.KonanDriver.run(KonanDriver.kt:151)
at org.jetbrains.kotlin.cli.bc.K2Native.runKonanDriver(K2Native.kt:167)
at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:63)
at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:32)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:102)
at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.kt:316)
at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.kt:294)
at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.kt:258)
at org.jetbrains.kotlin.cli.common.CLICompiler$Companion.doMainNoExit(CLICompiler.kt:395)
at org.jetbrains.kotlin.cli.bc.K2Native$Companion.mainNoExitWithRenderer$lambda$2(K2Native.kt:217)
at org.jetbrains.kotlin.util.UtilKt.profileIf(Util.kt:22)
at org.jetbrains.kotlin.util.UtilKt.profile(Util.kt:16)
at org.jetbrains.kotlin.cli.bc.K2Native$Companion.mainNoExitWithRenderer(K2Native.kt:216)
at org.jetbrains.kotlin.cli.bc.K2NativeKt.mainNoExitWithXcodeRenderer(K2Native.kt:235)
at org.jetbrains.kotlin.cli.utilities.MainKt$daemonMainWithXcodeRenderer$1.invoke(main.kt:52)
at org.jetbrains.kotlin.cli.utilities.MainKt$daemonMainWithXcodeRenderer$1.invoke(main.kt:52)
at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:20)
at org.jetbrains.kotlin.cli.utilities.MainKt.inProcessMain(main.kt:57)
at org.jetbrains.kotlin.cli.utilities.MainKt.daemonMainWithXcodeRenderer(main.kt:52)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.jetbrains.kotlin.internal.compilerRunner.native.KotlinNativeToolRunner.runInProcess(KotlinNativeToolRunner.kt:151)
at org.jetbrains.kotlin.internal.compilerRunner.native.KotlinNativeToolRunner.runTool(KotlinNativeToolRunner.kt:52)
at org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile$compile$1.invoke(KotlinNativeTasks.kt:594)
at org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile$compile$1.invoke(KotlinNativeTasks.kt:578)
at org.jetbrains.kotlin.compilerRunner.ReportUtilsKt.addBuildMetricsForTaskAction(reportUtils.kt:259)