Menu

When did SQLite WAL actually stop working for your FastAPI backend?

DEV Community: fastapi·Max K.·about 5 hours ago
#9PtwcjIO
#devtofastapi#devto#dev#conn#execute
Long article (859 words) — no AI summary yet.
Reading 0:00
15s threshold

Most small FastAPI services start on SQLite with PRAGMA journal_mode=WAL , pass local load checks, and stay quiet for months. Then one traffic burst hits a webhook endpoint or a background worker retries twenty jobs at once, and your logs fill up with sqlite3.OperationalError: database is locked .

I ran into this exact surprise while keeping webhook deduplication and small user-state tables inside a single-node FastAPI backend for an open Telegram Mini App ( https://github.com/angeldev-tech/ton-alpha-tma ). Turning on WAL felt like checking the "safe for concurrency" box. It was not.

The lock upgrade bug that skips busy_timeout

Even with journal_mode=WAL and busy_timeout=5000 , SQLite still allows only one writer at a time. That part is well known.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.