Repository navigation
Stop SFTP subprocess groups when a backup is cancelled - #36
Merged
Merged
Conversation
mikecerisano
force-pushed
the
fix/sftp-process-cancel-20261017
branch
from
October 17, 2026 15:04
35f4dc7 to
1abf0a0
Compare
mikecerisano
marked this pull request as ready for review
October 17, 2026 15:04
This was referenced Oct 17, 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.
A cancelled SFTP backup could leave an SSH
ProxyCommanddescendant holding stdout and stderr open after the directsshprocess exited. The old runner signalled only the direct process, then waited indefinitely for both pipes to drain. The transfer could remain stuck instead of settling as cancelled.The Mac-only runner now launches each command in its own process group with
posix_spawn, preserving fixed arguments, environment, and standard streams. Cancellation sends TERM to that group and escalates to KILL after two seconds. It keeps the leader PID reserved until the pipes close and the escalation is disarmed, then reaps it. Cancellation cannot be reported as success. The same pass prevents an early child exit from sending SIGPIPE to BitMatch while it writes SFTP batch input; a short write cannot yield a successful command result.Local validation on the rebased head:
SFTPRemoteBackupProcessTests: 8 passed, 0 failed, including a direct child that exits before cancellation while a TERM-ignoring descendant holds both pipes, a child that closes output before exiting, and an early-closed stdin pipe.git diff --check: clean.The combined follow-up SFTP branch also passed a real disposable localhost
sshdupload/readback test (1/1) using temporary keys, an agent, pinned known-hosts and a remote root. That exercises this runner with an actual SSH connection; the cancellation edge cases are covered by the focused subprocess tests. It does not establish compatibility with a shell-less, SFTP-only server or with an external server. SFTP is Mac-only. These are local gates; no manual GitHub CI rerun was used.