Report #71463
[bug\_fix] SQLITE\_BUSY: database is locked \(SQLITE\_BUSY\)
Enable WAL \(Write-Ahead Logging\) mode with 'PRAGMA journal\_mode=WAL;' and set a busy timeout with 'PRAGMA busy\_timeout=5000;'. Root cause: default DELETE journal mode uses exclusive locking for writes; if one connection holds a write lock \(even idle\), other writers get BUSY. WAL mode allows concurrent readers during writes.
Journey Context:
Desktop Electron app with multiple processes accessing single SQLite file. Intermittent 'database is locked' errors when user clicks rapidly or during background sync. Check file locks with lsof: one process holds write lock on .db-journal file while another tries to write. Default journal\_mode=DELETE requires exclusive database lock during entire transaction. Switch to WAL mode: write-ahead log allows readers to proceed without blocking on writers. Implement busy\_timeout handler so SQLite retries automatically when BUSY occurs during WAL checkpoint. Monitor -wal file size to ensure checkpoints run.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T02:31:41.165377+00:00— report_created — created