Skip to content

fix(linux-sqlite): tell a locked file apart from a full server - #3585

Merged
datlechin merged 4 commits into
mainfrom
fix/linux-sqlite-busy-message
Oct 19, 2026
Merged

datlechin merged 4 commits into
mainfrom
fix/linux-sqlite-busy-message

Conversation

@datlechin

Copy link
Copy Markdown
Member

Why

A save into a SQLite file another program holds locked said "The server has no room for another connection right now". SQLite's SQLITE_BUSY mapped to the same DriverError::Busy the server engines use for a full server or pool. The SQLite doc also said lock contention shows only at BEGIN IMMEDIATE, but in a rollback-journal file a reader elsewhere makes the COMMIT fail too.

Change

  • DriverError::Busy carries a BusyReason: NoFreeConnection for the server engines and the pool wait, FileLocked for SQLITE_BUSY. The app words FileLocked as another program or an editor tab with an open transaction holding the file's lock. The other engines keep their message.
  • SQLITE_LOCKED is now the server's own error: without a shared cache it is a conflict inside one connection.
  • The SQLite doc says where a lock shows (BEGIN IMMEDIATE for a writer, COMMIT for a reader in rollback-journal mode, never for a reader in WAL), and release criterion 5 moves to Holds today.

Verified

file_locked.rs holds a real lock from a second connection and checks a structure change, a commit held up by a reader, an import, an editor run, reads and opening the file: each fails as Busy(FileLocked) and the file keeps none of the save. write_batch_takes_write_lock_before_probe and session_read_concurrent_with_workspace_write_busy_or_commit_never_hangs now expect FileLocked.

Not in this PR

  • SQLite's pool wait (the one workspace connection held past 5 s) still reads "The server has no room for another connection".

@datlechin
datlechin merged commit f8a511a into main Oct 19, 2026
30 checks passed
@datlechin
datlechin deleted the fix/linux-sqlite-busy-message branch October 19, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant