You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
urlcode-store operator commands may starve on the write lock beside a busy server (unverified) #1072
main, with #1071 open at the time of filing. This is analysis only: nothing has been reproduced for the store.
Minimal reproduction
#1071 found that urlcode-auth create-user failed with database is locked on Windows CI while a serving process was committing continuously.
Cause. SQLite's busy handler (a 2 s busy_timeout) sleeps up to 100 ms between attempts and does not queue waiters. If each server commit holds the write lock for most of its time (a slow flush), all ~30 attempts can find the lock held.
packages/store/src/database.ts opens connections with PRAGMA busy_timeout=${BUSY_TIMEOUT_MS} (2000 ms). If the urlcode-store operator commands (members, reassign, audit, ...) set up their connection the same way, they would starve the same way beside a saturated server.
Unverified. I have not checked the store's operator code paths or reproduced the problem. packages/auth/test/slow-commit-writer.ts from #1071 is a writer that holds the lock 25 ms per commit and could be used to reproduce it.
Relevant output
Auth repro before #1071: beside a writer that holds the lock 20 ms per commit, 4 of 5 create-user calls failed after about 2.4 s with database is locked.
The fix replaces that rate assertion with read-only observation of the writer's committed rows, requiring fresh progress across each of the 15 operator rounds and the CLI call, with a bounded wait for a writer turn. The continuous 25 ms lock hold / 1 ms idle writer, all command success assertions, and final membership assertions remain. No production locking code or timeout changes are proposed. Validation is in progress.
Activity
fix(store): operator commands poll for the write lock beside a busy s…
jimhoyd commentedon Oct 1, 2026
The contention regression itself failed in the Node 24/macOS sweep at
9e8996bf: https://github.com/jimhoyd-com/urlcode/actions/runs/36805955980/job/110190237949 . Every operator call and the CLI command succeeded; the finalcommits > elapsed / 100assertion failed with 135 commits in 16603 ms. This is an implicit minimum writer throughput of 10 commits/second, which the contract does not promise on shared runners.The fix replaces that rate assertion with read-only observation of the writer's committed rows, requiring fresh progress across each of the 15 operator rounds and the CLI call, with a bounded wait for a writer turn. The continuous 25 ms lock hold / 1 ms idle writer, all command success assertions, and final membership assertions remain. No production locking code or timeout changes are proposed. Validation is in progress.