Menu

1 / 3

SQLite Says 'database is locked' at 4 Writers: WAL, busy_timeout and BEGIN IMMEDIATE

DEV Community: tutorial·Gabriel Anhaia·18 days ago
#xsJ1r6HJ
#devtotutorial#devto#dev#timeout#sqlite
Reading 0:00
15s threshold

Book: Database Playbook

Also by me: Thinking in Go (2-book series) — Complete Guide to Go Programming + Hexagonal Architecture in Go

My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools

Me: xgabriel.com | GitHub

SQLite on a production server stopped being a stunt a while ago. Rails 8 shipped with SQLite-backed adapters for its cache, its job queue and Action Cable, and the Rails team says there are "thousands of installations" of Campfire and Writebook running on SQLite. The SQLite authors themselves say a site with fewer than 100K hits a day should be fine, and call that figure conservative.

Then you add a second worker process. Then a cron job. Then a queue consumer. Four processes write to the same file, and the logs fill with database is locked .

That message is SQLITE_BUSY , and almost every fix you will find online is one of three settings: WAL mode, a busy timeout, or BEGIN IMMEDIATE . Most posts hand you all three at once.…

Continue reading — create a free account

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