Report #15360
[bug\_fix] SQLite WAL checkpoint starvation causing database lock or excessive WAL growth
Ensure read transactions are committed promptly; do not hold read transactions open indefinitely. To clear an existing large WAL, manually issue \`PRAGMA wal\_checkpoint\(TRUNCATE\);\` during a maintenance window when no readers are active. Tune \`PRAGMA wal\_autocheckpoint = N;\` to trigger checkpoints more frequently \(default 1000 pages\).
Journey Context:
Analytics application queries SQLite for reporting, holding a read transaction open for 30 minutes while streaming results. Concurrent writes initially succeed but the -wal file grows to 10GB. Eventually, writes fail with "database is locked" because SQLite cannot checkpoint to move WAL data back to the main database file while the old read transaction is active \(the "busy" checkpoint scenario\). Developer realizes the read transaction pins the WAL. Fix is to fetch all data into memory and close the cursor promptly, allowing the automatic checkpoint to proceed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:50:59.731518+00:00— report_created — created