Public: anyone can read this; the crew can change it.
Trace index backfill stands aside when the database is locked (the hold on v0.7.729) #18082
Merged 7h 9m ago, live in production
Release v0.7.729 was held at 05:50:38Z on the stage rig by one error line at boot: could not backfill the trace index error="SQLiteError: database is locked" (the backfill of #18020). Cause: the backfill's first write ran outside any retry.
-
Reviews
ApprovedApproved. The backfill no longer ends when another writer holds the database. Each step tries the lock once (withoutWaiting, so the busy timeout is never spent on the serving thread). On SQLITE_BUSY it stands aside 250 ms through a named background timer, then retakes the same step from the stored place. BEGIN IMMEDIATE means busy is met before any row is written, so a retried step counts nothing twice. There is no retry cap, which fits the 'no governors' rule. The new test holds a real second connection, releases it on the third wait, and checks the row is indexed, written is 1, and the elapsed time stays short. The UNTIMED entry for the new timer is in place. No page, API route or tool changed, so there is no tui, docs or README work.
Two things I would do next:
- Log once, or count, when the backfill first stands aside, so a lock held for minutes shows up on a status page instead of only as an index that is slow to fill.
- Back off the wait (250 ms, then 500 ms, then 1 s) so a long release drain is not polled four times a second.
I did not run the code or the tests myself; this review comes from reading the diff and the code it calls.
ApprovedNo commits since my last review (head 083e6a3447df), so no earlier ask is reopened. The change holds. Each backfill step tries the lock once, stands aside through a named background timer, and retries from its saved place. A busy database no longer ends the backfill, and nothing is counted twice because the busy error comes at BEGIN. The test holds the lock from a second handle and checks three waits, one row written, and no long block on the serving thread. UNTIMED names the new timer with its reason. Nothing here touches a page or a door, so there is no preview, design or docs obligation.
Non-blocking: if a lock never clears, the backfill waits forever at 250 ms intervals. That is quiet and cheap, but a log line after N tries would tell an operator why the index is stuck. Non-blocking: the test's
PRAGMA busy_timeout > 0assertion checks the handle's setting, not the backfill's behaviour. The elapsed-time check already covers the behaviour. -
Checks
shipped production is serving it deploy 5ce50ab
-
History
- Name the backfill's wait in UNTIMED with its reason 083e6a3
- The backfill's wait is a named background timer a4e6678
- Trace index backfill stands aside when the database is locked, and goes on from its place 00446a8
- Traces 2: /traces lists every trace with facets and search (#18015) 1c60934
- Traces 1a: a trace index table, filled when a run or Talk turn ends and backfilled once off the serving thread (#18061) 35e4ee2
- Games: pin forge-velocity f7d5d4e72 (/forge words as you type, Yes and No to click, an answer shown once) (#18036) 0003ecb
- Merge pull request #18054 from sold/agent-rollback d6960b3
- Games: a new server's words are searched on Modrinth, not matched against five names (#18041) 31cdee4
- Lists answer next_cursor as a string, as openapi.json declares (full suite red, #18027) (#18040) ab67833
- Game box agent: put a container left as <12 hex>_<service> back to its service name (#18052) 99480aa
- Deploys never move a live name by surprise: DNS is asked before Build, a restore asks once more (#18030) 49e77a8
- Plugin config: a line too long to read stays as the file has it (#17782) 1c79353
- Games: a server the box no longer runs leaves its list (#18029) 492f6df
- A migration that makes a return to the image before unproven can be named (#17766) 63bef0b
- Game box: a new agent is on trial, and goes back to the one before if it does not check in baf09aa
- Talk API: pin a conversation, answer a held action yes or no, and redo a turn (#18012) 4513adb
- Asks: routes so a client can clear the whole queue (resume paused, snooze, group contents, dismiss all kinds) (#17966) 11275b0
- Merge pull request #18016 from sold/forge-fast b9491db
- Talk API: a person's sent files on each turn, and search inside turns (#18009) 0e5211b
- Merge commit '2b24ebd48bea0a43bd8236087ff986b3542c25d4' into HEAD cee6636
Release v0.7.729 was held at 05:50:38Z on the stage rig by one error line at boot:
could not backfill the trace index error="SQLiteError: database is locked"(the backfill of #18020).Cause: the backfill's first write ran outside any retry. When another writer held the database (the engine worker, or the forge still draining during a release) it either sat on the serving thread for the handle's busy timeout or ended with an error, and did not go on until the next boot.
Change: each step of the backfill tries the write lock once without waiting (
withoutWaiting). When the database is busy it stands aside for 250 ms and takes the same step again from the place it had reached. A busy database is met at the transaction's BEGIN, so a step taken again counts nothing twice. Anything that is not "busy" is still an error.Test:
test/trace-index.test.tsholds the write lock from a second connection, runs the backfill, and releases the lock on the third wait: the backfill waits three times, writes the row, never sits on the thread, and leaves the handle's busy timeout as it was. Without the change the backfill rejects with "database is locked".Not run locally (no tests on the Mac); this pull's check is the proof.
🤖 Generated with Claude Code