Public: anyone can read this; the crew can change it.
"asks ledger failed: database is locked" two minutes after a release (v0.7.733) #18169
Merged 16h 18m ago, live in production
The asks ledger write that logged "database is locked" is now try-once, so it no longer holds the serving thread. A write behind a draining forge's lock is skipped and picked up again on the next tick. The new test and the asks, holds and job-slices suites pass, and tsc is clean.
-
Reviews
ApprovedApproved. A background tick with no page, terminal or design change; the preview's /asks is unchanged. Each viewer's sync runs under withoutWaiting, a busy database stops the tick at once with the count left, other errors still log, and both call sites now name their step. Reuses withoutWaiting and isBusy; no new dependency. The test holds BEGIN IMMEDIATE from a second connection, sees a fast return with nothing written, then the same rows after release.
Two things I would do next:
- Assert the log in the test: the tick's catch lives in the callers, so nothing proves 'no error line' beyond the tick not throwing. A small test on the log call, or moving the busy handling's logging into one place, would close that.
- The people left are the lowest priority in the order, so a lock held across many ticks always starves the same viewers. If that shows in practice, count a skipped tick in the log at info level so it is visible.
-
Checks
shipped production is serving it deploy f698c54
-
History
- Direction: the asks ledger tick never waits on another process's write lock, and names its step in the log (#18157) 22f26bb
- Traces 4: a Claude Code session file imports as a trace and is listed beside the others (#18129) 68f0754
- A game box stores spark profiles in the forge: POST /post gives a Location, reads need the box's game grants (#18146) b992c0d
- Games survival step 3: quality-of-life mods tried on a copy first (graves, essential-commands, sleep, harvest, vein miner, styled-chat) (#18145) f058287
- Spend 1: a monthly budget per cloud account, one notice at 80% and one at 100% (#18121) 3382c40
- Games: a proxy plugin update can wait until nobody has been on for 30 minutes (#18039) 9a5eb31
- Traces 5: compare two traces, and share one with secrets redacted (#18017) 7a17314
- AWS writes for mail setup are a named allowlist beside the read rule, and nothing else (#18142) 93c7c3d
- Traces 1c: GET /api/v1/traces/:id returns the thread, turns and steps as one tree (#18128) 077bab0
- A box's TPS and tick time show live on its games pane, from spark's health report or `/spark tps` at check-in (#18143) f7e559b
- Access 4c: the grants view as an MCP tool and a terminal screen (#18130) 89afadf
- small: the Absorb findings say they are ready for the owner to send to Ben (#18132) d41ec43
- Games survival step 2a: BlueMap behind login at /games/<box>/<server>/map, no published box port (#18100) 1132c91
- A Mac can take a repository's checks and report them on the pull (#17915) 4c72a1d
- Access 4: one view of every grant, and a page that says who may do what (#18062) 5ba07c8
- Access 2: one `may(principal, action, resource)`, with the repository checks behind it first (#18065) 7d48ce1
- Apps without a login 2: a tiny model in the browser fills the app's spec, and the compiler catches every failure (#18117) 4147a37
- Games: a new pin for the forge's proxy plugin replaces the old jar, in PLUGINS and on disk, and the page says which one loaded (#18111) da9e15f
- Healer: a server still starting, its log moving, is not started again (#18053) d918642
- Game box: refuse a wake or a mod install the box has no memory for (#18057) 7fe508f
The asks ledger write that logged "database is locked" is now try-once, so it no longer holds the serving thread. A write behind a draining forge's lock is skipped and picked up again on the next tick. The new test and the asks, holds and job-slices suites pass, and tsc is clean. I could not check the "three releases log 0 error lines" condition from here; that only shows after the next releases.
- Which write: it was
recordAskLedgerinsrc/web/studio/asks.ts. It runs every 2 minutes, from the engine tick (src/engine/duties.ts) or the serving tick (src/main.ts). The earlier fix made the ledger take the write lock first, but each viewer'sBEGIN IMMEDIATEstill waited out the 5 s busy timeout while the old forge held the lock. - Fix: each viewer's sync now runs under
withoutWaiting, like telemetry. If the database is busy, the tick stops and returns how many people it left, and logs nothing. The ledger is rebuilt from what asks people at each tick, so nothing is lost and the next tick catches up. Errors that are not "busy" still log as errors. - Log line: both call sites now add
step("engine tick: recordAskLedger" or "serving tick: recordAskLedger") to the "asks ledger failed" line. - Test (
test/ask-ledger-lock.test.ts): a second connection holdsBEGIN IMMEDIATEacrossrecordAskLedger. The tick returns well under the 5 s timeout, reports people left, throws nothing and writes no rows. After the lock is released, the next tick writes the same rows a quiet database would. - Not done: I added no new retry loop or queue, since the next tick is the retry. The step is on the log line, not threaded through every write inside the ledger. There is no page, terminal or docs change, because this is a background tick, and the commit says so in
No doorandNo looklines. - Reused:
withoutWaitingandisBusyfromsrc/kernel/db.ts; no new function was written.
To try it on the preview, open /asks. It lists the same asks, and the ledger line under it still counts them.
[{"go":"/asks","look":"the asks list and the 'Asks, 7 days' measure line","expect":"unchanged from production: same asks, same counts"}]
The asks ledger write that logged "database is locked" is now try-once, so it no longer holds the serving thread. A write behind a draining forge's lock is skipped and picked up again on the next tick. The new test and the asks, holds and job-slices suites pass, and
tscis clean. I could not check the "three releases log 0 error lines" condition from here; that only shows after the next releases.recordAskLedgerinsrc/web/studio/asks.ts. It runs every 2 minutes, from the engine tick (src/engine/duties.ts) or the serving tick (src/main.ts). The earlier fix made the ledger take the write lock first, but each viewer'sBEGIN IMMEDIATEstill waited out the 5 s busy timeout while the old forge held the lock.withoutWaiting, like telemetry. If the database is busy, the tick stops and returns how many people it left, and logs nothing. The ledger is rebuilt from what asks people at each tick, so nothing is lost and the next tick catches up. Errors that are not "busy" still log as errors.step("engine tick: recordAskLedger" or "serving tick: recordAskLedger") to the "asks ledger failed" line.test/ask-ledger-lock.test.ts): a second connection holdsBEGIN IMMEDIATEacrossrecordAskLedger. The tick returns well under the 5 s timeout, reports people left, throws nothing and writes no rows. After the lock is released, the next tick writes the same rows a quiet database would.No doorandNo looklines.withoutWaitingandisBusyfromsrc/kernel/db.ts; no new function was written.To try it on the preview, open
/asks. It lists the same asks, and the ledger line under it still counts them.Closes #18157