Repository navigation
fix: poll the remote shell with WNOHANG on a failed exit and signal it - #8372
Merged
Merged
Conversation
oferchen
force-pushed
the
fix/rsh-child-wnohang-cleanup
branch
from
November 11, 2026 09:42
937298b to
5a0a40a
Compare
oferchen
force-pushed
the
fix/server-fatal-report-route
branch
3 times, most recently
from
November 11, 2026 10:49
123b8cd to
7642d4a
Compare
oferchen
force-pushed
the
fix/server-fatal-report-route
branch
from
November 13, 2026 12:19
7642d4a to
474f57f
Compare
oferchen
force-pushed
the
fix/rsh-child-wnohang-cleanup
branch
from
November 13, 2026 12:21
5a0a40a to
72c8539
Compare
oferchen
force-pushed
the
fix/rsh-child-wnohang-cleanup
branch
from
November 13, 2026 16:17
72c8539 to
44366fa
Compare
oferchen
added a commit
that referenced
this pull request
Nov 14, 2026
…odebase (#8381) Updates and cleans up root documentation against the current codebase and upstream rsync 3.5.1 reference:\n\n- **README.md**: Update required status check count from 15 to 16 and include `rustdoc links` to match the repository ruleset.\n- **SECURITY.md**: Remove stale claim that `--fake-super` is unimplemented (implemented in PR #8348; `daemon-namecvt-empty-response` passes on Linux non-root legs), and update cargo-fuzz target counts to 36 total / 26 in `fuzz/` (adding `connection_handoff`) / 31 daily sweep targets.\n- **CHANGELOG.md**: Add recent `[Unreleased]` entries (#8354, #8364, #8372, #8375) and remove stray blank lines inside `### Changed`.
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.
Summary
Stacked on #8367.
A client whose transfer fails now leaves the way rsync 3.5.1's
_exit_cleanup()does:kill_all(SIGUSR1)does (cleanup.c:201-202, util1.c:692-709), and exits without waiting.Before, oc closed both pipes and blocked in
wait(), so a remote shell that ignored end-of-file held the client open until the shell exited by itself. A transfer that finishes still waits for the child, aswait_process_with_flush()does (main.c:198-227, :1179, :1454).Because the client now signals its remote shell, an rsh server has to write its fatal report before telling the client it is exiting, or the signal can cut the report off. 3.5.1 writes the cause line at the error site and
log_exit()'s trailer at cleanup.c:221-224, both on stderr (msgs2stderr = 2, options.c:103, log.c:357), beforeMSG_ERROR_EXITgoes out at cleanup.c:240-256. oc's rsh server wrote both after the transfer returned, so after the frame. A 3.5.1 client, which signals its rsh child, lost the oc server's trailer 3 of 3 times.Changes
Commit 1: poll and signal
rsync_io: newSshChildHandle::poll_exit(). It callstry_waitonce. If the child is still running, it sends SIGUSR1 on Unix and releases the child unreaped.platform::signal::send_sigusr1(): a safenixkill(2)wrapper, with a unit test.coressh drive: the handshake-failure path and the transfer-failure path both usepoll_cleanup_child().waitpidthat fails, or finds the child still running, leaves the local code standing. It no longer becomesRERR_WAITCHILD(21).transfer_failure_errornow takesOption<ExitCode>. The embedded transport passes its exit report.Commit 2: one fatal-report hook (on #8367)
FatalReporthook. The transfer now routes its lines the wayrwrite()routes each message:frames_errors()is true;announce_error_exit.queue_fatal_reportis renamedreport_fatal_failure.run.rs: oneserver_fatal_report()renders the lines, including fix: exit 12 and print 3.5.1's codec line on a compressed-stream failure #8352's generator-EOF case, and computes the exit code. AOnceLockrecords that the hook ran, and the post-return path then prints nothing. A failure before the transfer body starts is still reported after it returns.Oracle (3.5.1 tarball build, host)
Remote-shell stub that traps SIGUSR1, closes its stdout and sleeps 30 s without holding stderr:
Push into /dev/full over a shim that execs the server directly, 3 runs per pair. Results before this change:
After this change, 3.5.1 / oc prints both lines 3/3.
WNOHANG races the shell's exit in 3.5.1 too:
-e "sh -c 'exit 255'": exit 255 in 18/30 runs, 12 in 12/30.--rsync-path: 12 in 12/12.Twin of
push_cut_inside_the_goodbye, 3.5.1 at both ends:[generator] write error: Broken pipe (32)with a code 10 trailer, orconnection unexpectedly closed ... [generator]with a code 12 trailer.Tests
exit_codes::exit_code_12_stream_io::remote_shell_ignoring_eof_is_signalled_not_waited_for, push and pull.receiver_write_failure:version_exchangeunit test.ssh_transfer::ssh_stderr_not_reappended_to_error_message: 255 or 12.ssh_transfer::ssh_rsync_path_not_found: 12 or 127.rsh_peer_eof_whine::a_worse_remote_shell_status_keeps_the_whine_and_names_its_own_code: 127 or 12.rsh_peer_eof_whine:push_cut_aftershim'sddignores SIGUSR1 and keeps a copy of the client's stderr, so its tally is always written before the output is read.push_cut_inside_the_goodbyefilters lines tagged with a server role ([generator],[receiver], or a[generator=/[receiver=/[server=trailer), matching the 3.5.1 oracle above. The client's two lines are still asserted exactly.a_report_bound_for_stderr_is_left_to_the_callerbecomesa_report_bound_for_stderr_is_rendered_but_not_framed: the stderr route renders the report, and only the exit frame reaches the wire.Mutants (each failed the named cells)
compression_desync_exitpull cells (2/2).receiver_write_failurersh push and 3.5.1-client push (2).remote_shell_ignoring_eof_is_signalled_not_waited_for.Verification (host, at 937298b)
check_rustfmt_all.py: clean.cargo clippy --workspace --all-targets --all-features --no-deps -D warnings: clean.compression_desync_exit,receiver_write_failure,server_framed_fatal_report,exit_codes,rsh_peer_eof_whine,ssh_transfer, pluserror_exit_gate,send_sigusr1,transfer_failure_error,cleanup): 170/170.rsh_peer_eof_whine, 4 further runs: 20/20. An earlier 6-way load stress of the same binary (filter matching the role tag at line end only) passed 48/48. The final filter only drops more server-role lines.Residuals
local_failure_errorkeeps its peer-went-first filter for the embedded transport, whose exit report arrives only after the session closes.