Report #71795
[architecture] SQLite 'database is locked' errors under concurrent write load in web applications
Enable WAL \(Write-Ahead Logging\) mode via 'PRAGMA journal\_mode=WAL' and tune 'PRAGMA wal\_autocheckpoint' to balance read concurrency against checkpointing I/O; accept that SQLite remains single-writer but WAL allows concurrent reads during writes
Journey Context:
Default DELETE journal mode locks the entire database for writes, blocking all readers. WAL mode appends changes to separate files, allowing readers to access the last committed state without locks. However, writers still serialize; high write concurrency requires connection pooling with timeout retries. Checkpointing \(merging WAL back to main DB\) causes brief locks; tuning autocheckpoint prevents unbounded WAL growth. This pattern fails for >1k writes/sec or multi-region writes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T03:05:40.753471+00:00— report_created — created