Repository navigation
Run the task service's SQLite database in WAL mode - #437
Merged
Merged
Conversation
The on-disk store left SQLite at its default rollback journal, so a committing writer locked every reader out. Under ~25 live agents the dashboard's long-poll reads failed with `database is locked` (500s). Set journal_mode=WAL, synchronous=NORMAL and a 30 s busy_timeout on every new connection to a file-backed SQLite DB (in-memory engines untouched). The legacy-location DB move now carries any -wal/-shm sidecars with it, and the README notes the sidecars and how to back the DB up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The on-disk task store left SQLite at its default rollback journal (
journal_mode=delete), so a committing writer locked every reader out. With ~25 live agents writing (949 writes in 17 minutes), the service loggedsqlite3.OperationalError: database is locked, 8 of 9 on reads (list_tasks_summary/_tasks_snapshot). Those came back as 500s on the dashboard's long-poll and stalled its refresh.Plan: task artifact
plan.md(panopticon://tasks/1edca4fb888d4ce0a19ec6685a4800a0/artifacts/plan.md).Changes
store_sqlalchemy.py: aconnectlistener on file-backed SQLite engines setsjournal_mode=WAL,synchronous=NORMALandbusy_timeout=30000(_SQLITE_BUSY_TIMEOUT_MS). In-memory /StaticPoolengines are untouched. WAL mode is saved in the database file, so Alembic (make migrate) uses it too.migrate_db_to_home: when a DB is moved from a legacy location, any-wal/-shmfiles next to it are moved too. A DB in WAL mode can keep recent commits in those files.tests/core/test_store.py): the on-disk store reportswal/NORMAL/ the timeout; in-memory staysmemory; a read succeeds while another connection holdsBEGIN EXCLUSIVE. That last test fails withdatabase is lockedwithout this change. There's also a sidecar-move test intest_home_migration.py.-wal/-shmfiles and how to back up the DB (stop the service, orsqlite3 … .backup); AGENTS.md module map notes WAL.🤖 Generated with Claude Code