fix(backup): bound stalled SQLite snapshots - #68868
Open
jbryce wants to merge 2 commits into
Open
Conversation
jbryce
force-pushed
the
fix/sqlite-backup-lock-timeout
branch
from
July 22, 2026 09:08
4b74f3e to
c8dd54b
Compare
jbryce
force-pushed
the
fix/sqlite-backup-lock-timeout
branch
from
July 22, 2026 09:12
c8dd54b to
b4b3ca5
Compare
Contributor
|
Thanks for the focused SQLite-snapshot hardening. Current main still calls The PR preserves the existing fail-closed contract and moves failed-destination cleanup until after both connections are closed. Its deterministic busy/progress tests and exclusive-lock regression are relevant coverage for the reported failure mode. Automated hermes-sweeper review. |
This was referenced Aug 8, 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.
What does this PR do?
Prevents
hermes backupfrom blocking indefinitely when SQLite's online backup API encounters a persistently locked database.The backup now runs in finite page steps with SQLite busy handling disabled at the connection layer, then uses a monotonic progress callback to abort only after 30 seconds without a changed remaining-page count. Healthy large backups can run longer than 30 seconds as long as they continue making progress, including when concurrent source writes restart the online backup and increase the remaining-page count.
Failed snapshots still fail closed rather than raw-copying a live database, and partial destination files are removed after both SQLite connections close.
Related Issue
Related to #61703.
This complements #61704: that PR excludes one live Chromium profile, while this change provides a generic bound for any SQLite database that stops making progress.
Type of Change
Changes Made
hermes_cli/backup.pyto use finite SQLite backup steps and a monotonic no-progress deadline._safe_copy_db(...) -> boolAPI.BEGIN EXCLUSIVElock regression test.How to Test
scripts/run_tests.sh tests/hermes_cli/test_backup.py.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passThe repository's canonical targeted runner passed all 160 tests in
tests/hermes_cli/test_backup.py. Ruff andgit diff --checkalso passed. The full roughly 40,000-test suite was attempted on this host but did not complete, so the full-suite checkbox is intentionally left unchecked.Documentation & Housekeeping
docs/, docstrings) — N/A beyond the updated function docstringcli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs