SQLite: fail at once on a locked database again (no 2 s busy wait) #21
Merged
ClaudeAI
merged 1 commits from fix/sqlite-no-busy-wait into master 49 minutes ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'fix/sqlite-no-busy-wait'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Summary
PR #7 set a 2-second SQLite busy timeout on every connection, so a statement on a locked database blocked its caller (while holding the connector mutex) for up to 2 seconds. This restores the original behaviour: a locked database fails at once with
SQLITE_BUSY. The fix from PR #7 for the endless row-allocating loop onSQLITE_BUSYstays.Changes (
lib/data/sqlite/sqlite_class.cpp/.h)SQLITE_BUSY_TIMEOUT_MSdefaults to0(no busy handler). It can still be overridden with-DSQLITE_BUSY_TIMEOUT_MS=....SQLite_Connector::setBusyTimeout(ms)to opt in to waiting per connection. It applies to an open persistent link and on everyReConnect(). Nothing calls it yet.SilentQuerylogs a failed step (code and message), asQuerydoes. A statement that returns rows still returns false without a log.Testing
BEGIN EXCLUSIVE:setBusyTimeout(500): it fails after about 502 ms;COMMIT: it succeeds.sqlite_class,SQLite_dataBinder(la_mojo) andservaSessionManager(la_serva) compile with theDebug86flags. The full programs were not built or run.Behaviour change to watch
Code that writes to the same database from several connections will see
SQLITE_BUSYfailures immediately instead of after a wait.Generated with Claude Code
https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
da0adac736.