Report #57741
[bug\_fix] database is locked \(SQLITE\_BUSY\) in rollback journal mode
Root cause: SQLite's default DELETE journal mode \(rollback journal\) obtains an exclusive lock on the entire database file for any write transaction. If another write is in progress, or if a writer crashes and leaves a hot journal, subsequent writers get SQLITE\_BUSY immediately \(or after busy timeout\). Fix: Enable Write-Ahead Logging \(WAL\) mode via 'PRAGMA journal\_mode=WAL'. WAL allows one writer and multiple readers concurrently, eliminating the exclusive database lock except during checkpoint operations.
Journey Context:
You ship an Electron app using SQLite. Users report 'database is locked' errors when they click 'Save' while a background sync job writes batched telemetry. You check the code: both use the same db file, no WAL. You inspect with 'PRAGMA journal\_mode;' it returns 'delete'. You realize any write locks the whole file. You execute 'PRAGMA journal\_mode=WAL;' on app startup. The exclusive lock window shrinks to microseconds for checkpointing; simultaneous writes serialize gracefully instead of throwing SQLITE\_BUSY. You also set 'PRAGMA busy\_timeout=5000' as a safety net.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:24:36.687643+00:00— report_created — created