Repository navigation
fix: parallel first opens no longer fail with 'database is locked'; link check tolerates GitHub 503s - #163
Merged
Conversation
Switching a database to WAL takes an exclusive lock, and SQLite returns 'database is locked' for it at once instead of honouring busy_timeout. Several skills opening a new or pre-WAL database at the same moment failed about 1 open in 20; the #159 concurrency test hit it intermittently. The switch now retries briefly. WAL persists in the file, so only the first open ever switches it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
github.com throttles blob pages crawled from Actions runners with 503, which turned main red twice on 2026-11-20 with 1 and 18 'errors' on pages that exist. A broken link is a 404, which still fails. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI (Python 3.10, Linux) showed parallel first opens of a new database can also fail with 'database schema has changed' while another connection creates the tables, not only with the WAL switch's 'database is locked'. Every setup step is idempotent, so the whole setup is now retried on a fresh connection for either error, until a 10-second deadline; any other error raises at once. Deterministic tests inject each error; the parallel stress test now prints the failing tracebacks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| assert repo._conn is connections[-1] | ||
| assert repo._conn.execute("SELECT count(*) FROM runs").fetchone()[0] == 0 | ||
| finally: | ||
| repo.close() |
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.
Two flaky checks found while reviewing #162.
Parallel first opens fail with
database is lockedRunRepositoryswitches the file to WAL on every open. On a new database, or one that isn't in WAL mode yet, that switch needs an exclusive lock. SQLite returnsdatabase is lockedfor it immediately instead of waiting outbusy_timeout. When several skills open such a database at the same moment, about 1 open in 20 failed. The #159 testtest_runs_status_migration_is_idempotent_and_safe_under_concurrent_openshit this intermittently.CI on Python 3.10 then showed a second error from the same race:
database schema has changed, raised while another connection is creating the tables. Every setup step is idempotent (CREATE ... IF NOT EXISTS, race-safe column adds, a rebuild that re-checks under its lock). So the whole setup now retries on a fresh connection for either error, for up to 10 seconds; any other error raises at once. WAL persists in the file, so only the first open ever switches it.Tests:
test_parallel_first_opens_never_fail: 25 rounds of 6 threads released together by a barrier, for a missing database and an old one. Without the fix both cases fail on every run. On failure it prints the tracebacks.Link check fails on github.com 503s
The
Docs (links, version)job turned main red twice today, with 1 and 18 "errors", all503 Service Unavailableon github.com blob pages that exist. GitHub throttles those pages when Actions runners crawl them. 502 and 503 are now accepted; a broken link is a 404, which still fails the job.Verification
tests/test_sensor/test_python_probe.py::test_sensor_dying_mid_run_drops_events_without_blocking, which fails locally on macOS, onmaintoo. It is not touched here, and CI on Linux passes it.ruff checkon the touched files: no new findings.🤖 Generated with Claude Code