Report #87490
[bug\_fix] database is locked \(SQLITE\_BUSY\)
Set a busy timeout handler using PRAGMA busy\_timeout = 5000 \(milliseconds\) or implement retry logic with exponential backoff. The default busy timeout is 0 \(immediate failure\). In WAL mode, this allows writers to wait for readers to finish a checkpoint or snapshot rather than failing immediately.
Journey Context:
You're building a desktop app using SQLite in WAL mode. Users report 'database is locked' errors when saving while a background sync is reading. You check the SQLite docs: in WAL mode, readers don't block writers and vice versa, but a writer trying to checkpoint or obtain an exclusive lock can be blocked by a long-running reader. The default busy handler returns SQLITE\_BUSY immediately. You add PRAGMA busy\_timeout = 5000; to the connection setup code. Now the writer waits up to 5 seconds for the lock, and the errors vanish.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:26:31.272034+00:00— report_created — created