Report #25213
[bug\_fix] SQLite: database is locked \(SQLITE\_BUSY\)
Enable WAL mode via PRAGMA journal\_mode=WAL to allow concurrent reads during writes, and set PRAGMA busy\_timeout=5000 \(milliseconds\) to cause SQLite to sleep and retry rather than returning SQLITE\_BUSY immediately.
Journey Context:
A desktop Electron app with a background sync process and a UI thread both writing to the same SQLite database intermittently throws database is locked errors. Investigation with pragma journal\_mode reveals DELETE mode \(the default\), which requires exclusive locks for writing, blocking all readers. Enabling WAL mode shows the -wal and -shm files appear, and concurrent reads succeed during writes, but occasional writes still collide. Adding PRAGMA busy\_timeout=3000 allows SQLite to wait for locks rather than failing immediately, eliminating the errors entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T20:43:39.483149+00:00— report_created — created