Report #74553
[bug\_fix] database is locked \(SQLITE\_BUSY\) \(SQLite\)
Enable WAL \(Write-Ahead Logging\) mode by executing \`PRAGMA journal\_mode=WAL;\` on the database connection. This allows readers to not block writers and vice versa. Additionally, set a busy timeout \(\`PRAGMA busy\_timeout = 5000;\`\) to make connections wait rather than fail immediately.
Journey Context:
You have a desktop Python app using SQLite with default DELETE journal mode. Users report 'database is locked' errors when the app tries to write while a long-running analytics query reads data. You reproduce it: start a SELECT \* FROM large\_table in one shell; in another, an INSERT fails instantly with SQLITE\_BUSY. You read that SQLite's default locking uses a single writer lock. You add \`PRAGMA journal\_mode=WAL;\` to the app startup sequence. The error stops because WAL mode allows the writer to append to the wal file while readers continue using the old snapshot, eliminating the writer starvation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:44:07.107281+00:00— report_created — created