fix: bound pre-update SQLite backups - #72966
roycepersonalassistant wants to merge 1 commit into
Conversation
|
Thanks for the focused backup hardening. The premise remains live on current main: The Chrome profile targeting also matches the managed browser path: Current-main production code has not changed since the PR base; only Automated hermes-sweeper review. |
4054a46 to
ba43793
Compare
|
Superseded by #88853. The replacement is attached to the rebased and locally verified tree at 24440be, reconciles the contribution with current main’s independently landed busy/locked timeout, and preserves the remaining non-advancing-progress and Chrome-cache protections. Closing this stale record because GitHub no longer associated it with updates to its original fork branch. |
Summary
sqlite3.Connection.backup()when it makes no forward progress, preventingSQLITE_BUSY/SQLITE_LOCKEDand non-advancingSQLITE_OKcallbacks from hanging update backups indefinitelychrome-debugdata while preserving durable browser state such as cookies and loginsRoot cause
CPython's SQLite backup loop retries a busy source internally. The source connection's default busy handler can delay the first progress callback, and without an exception from that callback the loop can retry forever. A Chrome GPU/cache database held by a live helper process therefore stalled the pre-update full backup.
This change uses a short connection busy timeout plus a five-second no-progress deadline in the backup progress callback. The deadline resets only when the remaining page count decreases, so healthy large databases are not subject to a total wall-clock limit while busy, locked, or non-advancing sources remain bounded.
Current-main refresh
mainat66ea4e686de8f0147058fd97860f9cba154d821atests/hermes_cli/test_backup_stability.pySQLITE_OKpath that the original implementation did not boundTest plan
/Users/royce/.local/bin/uv run --extra dev pytest -o 'addopts=' tests/hermes_cli/test_backup.py tests/hermes_cli/test_backup_stability.py -q— 50 passed/Users/royce/.local/bin/uv run --extra dev ruff check hermes_cli/backup.py tests/hermes_cli/test_backup_stability.py— passed/Users/royce/.local/bin/uv run python -m compileall -q hermes_cli/backup.py tests/hermes_cli/test_backup_stability.py— passedgit diff --check origin/main...HEAD— passedba437934a0c3044da08b4d10191a6ff903df5f5bFocused regressions cover a locked SQLite source, repeated non-advancing
SQLITE_OKcallbacks, locked Chrome cache data in a named profile, preservation of persistent browser state, and the existing fail-closed durable DB archive behavior.Review
SQLITE_OKno-progress remediationRisk / rollback
Low and isolated to backup traversal/snapshot behavior. Revert the refreshed commit to restore prior behavior. No live databases, backups, gateways, or runtime configuration were touched while preparing this refresh.