Report #61729
[bug\_fix] SQLITE\_BUSY: database is locked \(rollback journal mode\)
Enable Write-Ahead Logging \(WAL\) mode using \`PRAGMA journal\_mode=WAL;\` and set a busy timeout using \`PRAGMA busy\_timeout=5000;\` to allow readers and writers to coexist.
Journey Context:
Developing a desktop app with Python/SQLite. Single writer process, but multiple reader processes. Occasionally, writes failed with 'database is locked'. Investigation showed default \`journal\_mode\` was DELETE \(rollback journal\). In this mode, writers lock the entire database file, and readers block or get SQLITE\_BUSY if they try to read during a write. Checked SQLite docs on WAL mode. WAL allows readers to read from a snapshot while writer appends to WAL file. Executed \`PRAGMA journal\_mode=WAL;\` on connection. Also set \`PRAGMA busy\_timeout = 5000;\` to handle transient locks. Problem resolved.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:06:07.491714+00:00— report_created — created