Report #60571
[bug\_fix] WAL checkpoint starvation – SQLite WAL file \(-wal\) grows unbounded
Prevent long-running read transactions \(which hold back the checkpoint pointer\); manually run PRAGMA wal\_checkpoint\(TRUNCATE\) during maintenance, or restart the application to release readers and allow automatic checkpointing to truncate the WAL.
Journey Context:
An IoT device uses SQLite to store sensor data. A background analytics job keeps a read transaction open for 24 hours to calculate weekly averages. Meanwhile, high-frequency writes continue. The -wal file grows from 4MB to 60GB, filling the device's flash storage. The developer checks \`PRAGMA wal\_checkpoint;\` and sees busy=1, meaning a checkpoint is blocked. Using \`lsof\` or \`PRAGMA wal\_checkpoint\`, they identify the long-running reader. They realize SQLite cannot checkpoint past the oldest active read transaction. They modify the analytics job to copy data to a temporary in-memory store or commit the read transaction periodically. They also add a monitoring hook to run \`PRAGMA wal\_checkpoint\(TRUNCATE\)\` during a maintenance window when no readers exist, immediately reclaiming disk space.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T08:09:27.369298+00:00— report_created — created