Skip to content
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

SQLiteException: Database is locked #8049

Open
1 task
charlag opened this issue Nov 28, 2024 · 1 comment · May be fixed by #8294
Open
1 task

SQLiteException: Database is locked #8049

charlag opened this issue Nov 28, 2024 · 1 comment · May be fixed by #8294
Assignees
Labels
android issues that concern the android client but not all clients bug broken functionality, usability problems, unexpected errors

Comments

@charlag
Copy link
Contributor

charlag commented Nov 28, 2024

v250.241025.0 and up

Error message:
error code 5: database is locked

Stacktrace:
net.sqlcipher.database.SQLiteException: error code 5: database is locked
	at net.sqlcipher.database.SQLiteStatement.native_execute(Native Method)
	at net.sqlcipher.database.SQLiteStatement.execute(Unknown Source:19)
	at net.sqlcipher.database.SQLiteDatabase.execSQL(SourceFile:0)
	at de.tutao.tutashared.offline.AndroidSqlCipherFacade.run(Unknown Source:8)
	at de.tutao.tutashared.ipc.SqlCipherFacadeReceiveDispatcher.dispatch(Unknown Source:339)
	at de.tutao.tutashared.ipc.AndroidGlobalDispatcher.dispatch(Unknown Source:154)
	at de.tutao.tutanota.RemoteBridge.invokeMethod(Unknown Source:62)
	at de.tutao.tutanota.RemoteBridge.handleMessageFromWeb(Unknown Source:204)
	at de.tutao.tutanota.RemoteBridge$initMessageChannel$1$onMessage$1.invokeSuspend(Unknown Source:41)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:11)
	at kotlinx.coroutines.DispatchedTask.run(Unknown Source:98)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(Unknown Source:0)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(Unknown Source:14)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(Unknown Source:28)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(Unknown Source:0)

Estimated: 8h
Taken: 4h

Test notes:

  • Test offline login, that you can see mails in offline mode
@charlag charlag added android issues that concern the android client but not all clients bug broken functionality, usability problems, unexpected errors labels Nov 28, 2024
@charlag
Copy link
Contributor Author

charlag commented Jan 13, 2025

This can probably happen when we are writing from notification process and then at the same time try to write from the main process.

https://discuss.zetetic.net/t/database-locked-error-code-5/1763

Theoretically SQLite has WAL mode:
https://www.sqlite.org/wal.html

but I'm almost sure it won't work because we are using it across processes.

We can try adding automatic retry on locked errors. We can also try to see how Android implements multiprocess Room.

@wrdhub wrdhub self-assigned this Jan 16, 2025
wrdhub added a commit that referenced this issue Jan 16, 2025
@wrdhub wrdhub linked a pull request Jan 16, 2025 that will close this issue
@wrdhub wrdhub linked a pull request Jan 16, 2025 that will close this issue
wrdhub added a commit that referenced this issue Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android issues that concern the android client but not all clients bug broken functionality, usability problems, unexpected errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants