Report #72363
[bug\_fix] SQLite database is locked \(SQLITE\_BUSY\)
Enable WAL \(Write-Ahead Logging\) mode via PRAGMA journal\_mode=WAL and set PRAGMA busy\_timeout=5000 \(milliseconds\). Root cause: Default rollback journal locks the entire database during writes; multiple connections cause lock contention, and SQLite returns BUSY immediately without waiting by default.
Journey Context:
Flask app with background threading started throwing OperationalError: database is locked during concurrent updates. Checked that no other processes had the file open. Enabled WAL mode which allows readers to proceed during writes, but still got intermittent BUSY errors. Realized busy\_timeout defaults to 0 \(immediate return\). Added PRAGMA busy\_timeout=5000 so SQLite waits up to 5 seconds for locks instead of failing immediately. Concurrency errors dropped to zero.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T04:02:55.216301+00:00— report_created — created