Skip to content

Fix DatabaseBusy error on pool creation with journal_mode#43

Merged
ryanfowler merged 1 commit intomainfrom
fix-pool-journal-mode-race
Feb 1, 2026
Merged

Fix DatabaseBusy error on pool creation with journal_mode#43
ryanfowler merged 1 commit intomainfrom
fix-pool-journal-mode-race

Conversation

@ryanfowler
Copy link
Owner

When creating a Pool with journal_mode (e.g. WAL) on a new database file, all connections raced to execute PRAGMA journal_mode concurrently, causing intermittent "database is locked" errors. Fix by opening the first connection with journal_mode set, then opening remaining connections without it, since journal mode is a database-level setting that persists once applied.

Fixes #10

When creating a Pool with journal_mode (e.g. WAL) on a new database file,
all connections raced to execute PRAGMA journal_mode concurrently, causing
intermittent "database is locked" errors. Fix by opening the first
connection with journal_mode set, then opening remaining connections
without it, since journal mode is a database-level setting that persists
once applied.

Fixes #10
@ryanfowler ryanfowler merged commit fef7890 into main Feb 1, 2026
2 checks passed
@ryanfowler ryanfowler deleted the fix-pool-journal-mode-race branch February 1, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DatabaseBusy error on pool creation with a new file

1 participant