Open silverhammermba opened 1 year ago
Reviewing. It's not "not thread safe" so much as the in-memory modes of sqlite are somewhat different than the disk modes, and the other drivers probably do more management of connections and threading directly (I am intimately familiar with the android driver, and it does do that).
Also, there have been updates to the sqliter in-memory management and I'll need to correlate sqldelight version with sqliter version to see if those are in there.
However, those updates are just for no-name in-memory driver. Supplying a name allows multiple connections and shared memory "disk", but that has different rules than no-name in-memory, and both act differently in certain cases than a disk connection.
On "not thread safe", that generally implies a data corruption issue, which this is not. It's a resource contention issue. It's an issue, but just want to be clear, it's not a data corruption problem.
SQLDelight Version
1.5.4
Application Operating System
Native
Describe the Bug
When using an in-memory native DB, I reliably get
executeNonQuery error | error code SQLITE_LOCKED
when multiple threads are inserting/selecting simultaneously.This test reproduces the exception. I cannot get it to happen when using
inMemory = false
. I also get no exception when using JDBC's in-memory DB on JVM, so it seems like the issue is specific to the native in-memory mode.It is unclear whether this is a SQLDelight or SQLiter bug since the
inMemory
stuff is implemented here. But maybe it's another limitation of the underlying driver. I have reported the bug against both projects.Stacktrace