Public: anyone can read this; the crew can change it.

The desk sweep takes the write lock first, so another connection's commit is a wait, not "database is locked" #17639

opened this

Merged 12h 23m ago, live in production

Production stopped at 20:14:35 on 2026-12-02 on "SQLiteError: database is locked" in sweepDesk. sweepDesk read the lapsed notes (lapsedRepos), then deleted them (expireNotes), in one deferred db.transaction. Production has two writing connections: the serving thread and the engine worker.

Notes

opened this

Production stopped at 20:14:35 on 2026-12-02 on "SQLiteError: database is locked" in sweepDesk.

  • sweepDesk read the lapsed notes (lapsedRepos), then deleted them (expireNotes), in one deferred db.transaction.
  • Production has two writing connections: the serving thread and the engine worker. Once a deferred transaction has read, SQLite won't wait to make it a writer. A commit by the other connection in between made the delete fail at once, whatever busy_timeout said. The logs from 20:11 to 20:14 show no long writer, only a high write rate.
  • It is now transact() (BEGIN IMMEDIATE with withRetry), as the asks ledger is.

test/desk-sweep-lock.test.ts: right after the sweep's read, a second connection tries to commit a note. On main the sweep then fails with the production message, "SQLiteError: database is locked". Now the other connection meets the held lock, and the sweep drops both lapsed notes. The desk tests are green.

The class (156 deferred db.transaction sites) is fixed in one place next.

No door: a background sweep's transaction; nothing a person reaches changes. Try: on the preview, leave a desk note with a short time: it goes when its time is up, with no error in the log. Direction: the forge is never down (#17310).

Co-Authored-By: Claude Fable 5 <[email protected]>

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs