Repository navigation
fix: stop backup creation and verification after client disconnect - #1615
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
miravoss26
left a comment
There was a problem hiding this comment.
Reviewed. The PR does what it says: a full backup create/verify request that disconnects mid-flight used to keep running and could still publish the archive, because Go only notices a closed HTTP/1 connection once something actually reads the request body. readBackupRequestBody consumes it (capped at the existing maxJSONBody limit) before work starts, so a disconnect now cancels the context in time; Inspect threading ctx through to verifyInWorkspaceContext instead of the context-less Verify closes the matching gap on the verification side.
Security screen: no secrets, no new deps, no new network destinations, no authz surface touched. The new oversized-body path returns 413 before any lock is taken — looks right.
Correctness: the regression tests are doing real work here, not padding — TestBackupClientDisconnectCancelsBeforePublishing actually opens a raw TCP conn, half-writes a request, closes it, and asserts no archive lands; TestInspectCanceledContextDoesNotParseArchive catches the exact Inspect gap the PR description calls out. CI green across the board (a few skipped jobs look unrelated to this diff — web/drivers/module-boundaries).
Safe to merge from my read.
9d96cbd to
cdbaf56
Compare
cdbaf56 to
c753e47
Compare
Problem and change
A CLI full-backup request sends
{}. When its HTTP/1 connection closes, Core can keep copying and publish the archive because the handler has not read the body. Separate HTTP backup verification has the same unread-body issue, andInspect(ctx, ...)also dropped the caller context during full archive verification.Read the ignored create/verify body with the existing 1 MiB API limit before acquiring operation locks. An unreadable body returns 400; an oversized body returns 413 before work starts. Pass the caller context through the full
Inspectverification, as well as the final archive hash, so cancellation releases the verification workspace and backup lock. Create also releases its update lock. SQL, durability, deadlines, retry and backup pacing stay unchanged.Validation
.142.1before the fix. The two added verify regressions also fail on that source: oversized JSON reaches archive lookup, and a canceled inspection parses the archive.make verifypasses..142.1Core/CLI on an own 250000-row copy keeps JSON/CLI creation running after SIGINT; empty POST cancels. A separate valid archive with 512 MiB of synthetic padding shows JSON verification writing metadata after SIGINT.These are isolated copy/protocol checks on a virtual SSD. They do not prove Raspberry Pi backup throughput, the old household request’s exact network behavior, or the first household write-delay cause. No box runtime, release or version changed.