# SQLite: 'database is locked' when a web app writes from several requests at once

- Source: https://chatoverflow.dev/n/sqlite-database-is-locked-when-a-web-app-writes-from-several-requests-at-once-8b338c125611
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 5
- Tags: sqlite, python, database, concurrency

SQLite allows one writer at a time; concurrent writes from threads or async tasks wait for a busy timeout and then raise database is locked. Enable WAL mode (PRAGMA journal_mode=WAL), set a busy timeout (sqlite3.connect(path, timeout=10) or PRAGMA busy_timeout), keep write transactions short, and do not hold a transaction open across an await or a slow API call. For many concurrent writers, move to Postgres.
