A census COUNT(*) reader held for 8 to 10 minutes pins the WAL: 0 to 26 GB in 80 minutes, then edits stall and the daemon exits
Related: #1072, #1088, #1738. Measured on one machine on 2026-12-01 (macOS, v0.64.11 until 14:10 local, then v0.64.12; 22 tracked repositories plus about 120 linked worktrees; store about 33 GB).
Write-ahead growth behind a long reader (v0.64.11). After an offline wal_checkpoint(TRUNCATE) at 12:01 left the write-ahead file at 0 bytes:
- From about 12:45, stderr repeated
WARN wal reclaim blocked by a long reader: age=8m34s ... statement="SELECT COUNT(*), COALESCE(SUM(CASE WHEN repo_prefix <> '' AND (file_path <> '' AND kind NOT IN ('contract', 'contract_bridge', 'topic', ...(laterage=9m45s), withwal reclaim deferred reason="writer_hold_cap older_readers_in_flight"andreason="writer_gate". reindex writer gate contended, dropping 27 rebind(s)at 12:57, after which the process wrote nothing more to stderr. MCP edits timed out at the 59 s client deadline from about 12:50 (watcher: mutation admission timed out; deferring patch,daemon: control request exceeded its budget).- The process exited; the service manager started a new one at 13:20, which logged
wal reclaim last resort wal_bytes=26440347232 ... reason="writer_gate". So the file grew from 0 to 26.4 GB in about 80 minutes. - After that restart it grew again, to 10.1 GB within about seven minutes (13:43 to 13:50).
The census query above is the reader that pinned the WAL here, so this may be a concrete instance of #1072 (long readers pinning the WAL) and #1088 (WAL ceiling outside the bulk window).
Start-up after upgrading to v0.64.12. The pre-upgrade backup (store.sqlite.v40.backup, 33.7 GB) took under a minute; the daemon then reported ready — queryable (warmup 16m37s); enrichment in progress at 586 MB RSS, with the write-ahead file at 51 MB. Edits through MCP have applied in under a second since. A 16.5-minute warm-up is the remaining pain point on this setup; happy to collect a trace with whatever flags help.
Local mitigation, in case it helps others: a scheduled job runs every 15 minutes, and when the write-ahead file passes 8 GB it stops the daemon, runs PRAGMA wal_checkpoint(TRUNCATE) offline (about 90 s for 10 to 15 GB here), and starts it again.
The long census-reader warning also occurred on v0.64.12 in the December 2 daemon lifetime ending at 15:12:51 local time. There were nine long-reader warnings in that lifetime. At 13:53:59 the reported reader was 2m09s old; its statement began with the same whole-index COUNT and conditional SUM. At 13:58 the reclaim loop still reported an older reader in flight.
Later in the same daemon lifetime, the store separately reported passive checkpoint deferral for a busy build lane and a deferred bulk-finalization checkpoint. These observations do not establish that the early reader remained open until the eventual 11.53 GB WAL measurement. This issue tracks the reader lifetime; issue 1784 contains the independent write and checkpoint observations.