Repository navigation
store: the findings snapshot waits for the write lock instead of failing at once - #975
Merged
Merged
Conversation
…ing at once `record_scan_snapshot` opened a deferred transaction, read the newest row, then wrote. That first write is an upgrade from a read transaction, and SQLite calls the busy handler only when the connection holds no transaction at all, so the upgrade returned `database is locked` without one retry whenever another process held the write lock. The live log has 11 such failures in 16 days, all from this one writer, two of them on the installed build 0e3d584 inside the learner's hourly write burst, and none beside a wait anywhere near the 10 s budget. The transaction now begins immediate, as `update_kv` already does, so the lock is taken by a statement the busy handler covers. The test holds a write transaction on a second connection for 200 ms and expects the snapshot to wait and be recorded; before the change it failed in 0.2 s with the error from the log. Closes #974. Generated-by: claude-code/claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #974. Part of #913.
What
Store::record_scan_snapshotbegan a deferred transaction, read the newest row, then wrote. The first write upgrades a read transaction, and SQLite does not call the busy handler for that upgrade, so it failed at once withdatabase is lockedwhenever another process held the write lock. The transaction now begins immediate, the same wayupdate_kv(crates/libs/store/src/store/kv.rs:13) already does.Evidence
findings snapshot not recorded: database is lockedlines inartifacts/logs/svanbot10.logfrom 2026-09-28 to 2026-10-14, and nodatabase is lockedfrom any other writer. Two of them are on the installed build 0e3d584, both inside the learner's hourly write burst, with no lock wait reported beside them.store::slow::tests::a_read_then_write_waits_for_the_lock_instead_of_failing_at_once: a second connection holds a write transaction for 200 ms. Onmainthe snapshot fails in 0.2 s withError code 5: database is locked; with the change it waits and is recorded.Checks
scripts/check.sh fullgreen in the worktree: 900 passed, 0 failed, 4 ignored.compact_rowsand the two one-time backfills have the same read-then-write shape but no failure in the log, andcompact_rowsdepends on the failed upgrade on purpose.Generated-by: claude-code/claude-opus-5-5
🤖 Generated with Claude Code