Report #39632
[bug\_fix] database is locked \(SQLite\)
Execute PRAGMA busy\_timeout = 5000 \(milliseconds\) to force SQLite to wait for locks instead of returning SQLITE\_BUSY immediately; additionally enable WAL mode \(PRAGMA journal\_mode=WAL\) for improved concurrent read/write performance. Root cause: SQLite's default busy handler timeout is 0, causing immediate failure when another connection \(even in the same process\) holds a lock.
Journey Context:
A Flask web application using SQLite works fine in single-threaded development mode. When deployed to production using a threaded WSGI server, intermittent 'database is locked' errors appear during concurrent requests. Debugging reveals that one thread is writing while another attempts to read, and SQLite's default behavior is to fail immediately. Setting PRAGMA busy\_timeout=30000 causes the second thread to wait instead of erroring, completely resolving the issue.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T20:59:45.506634+00:00— report_created — created