Skip to content

fix(db): retry transient SQLite writer locks - #106

Merged
abrichr merged 1 commit into
mainfrom
codex/sqlite-lock-retry
Aug 27, 2026
Merged

fix(db): retry transient SQLite writer locks#106
abrichr merged 1 commit into
mainfrom
codex/sqlite-lock-retry

Conversation

@abrichr

@abrichr abrichr commented Aug 27, 2026

Copy link
Copy Markdown
Member

What changed

Capture now retries an insert when another SQLite writer holds the per-capture database lock for a short time. It rolls back the failed transaction before each retry and stops after two retries. If the lock remains, the writer still exits with an error and Recorder reports that failure.

The SQLite connection's existing five-second lock wait is now explicit. The total database wait is bounded at about 15.25 seconds.

Why

A Windows live-recorder run failed when the memory-stat process hit a database lock while other capture writers were committing. This change lets a short conflict clear. It doesn't accept a partial database or hide a writer failure.

Test evidence

  • A real-file test holds the SQLite lock, releases it during the first retry, and confirms one row is committed.
  • A second test keeps the lock and confirms the final write error still reaches the caller.
  • The Python 3.10 fallback covers the database, table, and schema lock messages.
  • The focused retry and writer suite passes: 12 tests.
  • The full local suite passes: 605 tests, with 13 expected skips.
  • Ruff and the diff check pass.

@abrichr
abrichr merged commit d560e45 into main Aug 27, 2026
12 checks passed
@abrichr
abrichr deleted the codex/sqlite-lock-retry branch August 27, 2026 20:31
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