Fix for SQLite3::BusyException: database is locked during parallel platform sync#40
Merged
Merged
Conversation
…platform sync ## Summary (generated via claude) **Problem** `SyncManager#execute_sync` runs all platforms concurrently (`Concurrent::Promises.future`), and each writes to the same SQLite file via `DiffEngine`. With the default rollback journal, a reader blocks a writer, so under contention a write fails within the 5s timeout and raises `database is locked` - silently skipping that program for the cycle. Example: `ERROR [hackerone] Failed to process program xyz_bbp: SQLite3::BusyException: database is locked` **Fix** Configure SQLite for concurrent access in `Database.connect`: - WAL journal mode so readers no longer block the writer (the actual fix) - Busy timeout raised to 10s so writers wait instead of erroring - `synchronous = NORMAL` (recommended WAL pairing) WAL persists in the DB header, so one call covers all pooled connections; `:timeout` is applied per-connection by Sequel.
Owner
|
Hi,
|
JoshuaMart
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary (generated via claude)
Problem
SyncManager#execute_syncruns all platforms concurrently (Concurrent::Promises.future), and each writes to the same SQLite file viaDiffEngine. With the default rollback journal, a reader blocks a writer, so under contention a write fails within the 5s timeout and raisesdatabase is locked- silently skipping that program for the cycle.Example:
ERROR [hackerone] Failed to process program xyz_bbp: SQLite3::BusyException: database is lockedFix
Configure SQLite for concurrent access in
Database.connect:synchronous = NORMAL(recommended WAL pairing)WAL persists in the DB header, so one call covers all pooled connections;
:timeoutis applied per-connection by Sequel.