Repository navigation
fix: name the pull receiver and its exit code by upstream's fork phase and error class - #8287
Merged
Merged
Conversation
oferchen
added a commit
that referenced
this pull request
Oct 29, 2026
oferchen
changed the base branch from
fix/rsh-handshake-epipe-exit-12
to
master
October 30, 2026 00:34
A pulling upstream client forks once its file list is in (main.c:1077 do_recv()): before that it is the lone "Receiver", after it the receiver child and the generator parent each report their own failures (rsync.c:987-995 who_am_i()). The receiver now marks that point on a ForkPoint, and one class mapping shared by the remote-shell and daemon transports turns a failure into upstream's report: - before the fork, every report names [Receiver]; - after it, end of stream and a reset socket print the receiver's report, then the generator's whine with its own count and exit 12, because those classes send no MSG_ERROR_EXIT (cleanup.c:240-256); - a --timeout after the fork is the generator's, followed by the receiver's SIGUSR1 trailer (io.c:256-266); - a peer exit code after the fork is closed by [generator]. The generator's count is the fork snapshot plus what the receiver forwards it: sub-lists (rsync.c:377-381), NDX_FLIST_EOF (rsync.c:359) and one notice per received file under inc_recurse, --remove-source-files or a hard link (receiver.c:1341-1347). A daemon pull no longer falls back to 23: end of stream exits 12, a reset socket 10, a silent peer under --timeout 30, and a destination root the client cannot create 11 with upstream's "mkdir ... failed" line (main.c:817-821).
oferchen
force-pushed
the
fix/pull-trailer-role-and-daemon-exit-class
branch
from
November 3, 2026 06:43
4be3ca9 to
4335623
Compare
Upstream exits on a received MSG_ERROR_EXIT through _exit_cleanup(val, __FILE__, 0 - __LINE__) (io.c:1930), and the negative line keeps log_exit() quiet (cleanup.c:221-225): the peer already reported the failure. Only a --log-file run without --info=stats still prints the trailer. oc added its own trailer.
Before multiplexed I/O starts, upstream reads the peer through safe_read() (io.c:351-358): a failed read() is "safe_read failed to read %d bytes" with the length the caller asked for, then exit_cleanup(RERR_STREAMIO). oc reported perform_io()'s "read error" and exited 10. The handshake reads in setup_protocol now mark their I/O failures; an end of stream or a timeout keeps its own path.
fix: print no exit trailer after the peer's MSG_ERROR_EXIT
fix: report a handshake reset as safe_read's failure, exit 12
This was referenced Nov 3, 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.
Summary
A failed pull now reports from the process upstream would report from, and a daemon pull exits by error class instead of a flat 23.
A pulling upstream client receives the file list as one process (
who_am_i()=Receiver). It then forks indo_recv()(main.c:1077): the child becomes the receiver (main.c:1083) and the parent the generator (main.c:1142), and each reports its own failures (rsync.c:987-995). oc runs both halves in one context. AForkPointmarker now records when the receiver crosses that fork, and one class mapping (local_failure_error) turns a failure into upstream's report on both the remote-shell and daemon transports.What changes:
[Receiver], as the lone pre-fork client.read error, plus its trailer;MSG_ERROR_EXIT).--timeout: the generator times out, because check_timeout() returns early foram_receiver(io.c:256-266). The receiver then printsreceived SIGUSR1 (code 19), and the run exits 30.[generator], the last process to exit.inc_recurse || remove_source_files || hlinked(receiver.c:1341-1347).rsync: [Receiver] mkdir "<path>" failed: <strerror> (<errno>), exit 11 (main.c:817-821). The server receiver keeps its old report, because upstream fails its change_dir#4 into the destination first (main.c:1209-1217).[Receiver] read error: ...),--timeout30 ([Receiver] io timeout after N seconds -- exiting), uncreatable destination root 11.Oracle
Every expected report was printed by the tarball build of rsync 3.5.1 (
/home/ofer/up351/rsync-3.5.1/rsync), never the Arch git build. Each case was compared line by line with oc.Remote shell, fixed cut. A stub forwards exactly N bytes of the server's output, then kills it. Flat tree of three 100 KB files:
-r[Receiver]-r-r-r --no-i-r-r --no-i-r --remove-source-files-r, two subdirsoc matches every row.
Daemon pull. A tarball 3.5.1 daemon behind a one-shot TCP proxy cut at N bytes: EOF at 2000 gives 1905/79, at 150000 gives 149905/87. A reset at 2000 gives
[receiver] read error(code 10), then the generator whine (code 12), rc 12. A replayed daemon stream (the existingdaemon_pull_unexpected_close_byte_countfixture) gave every row of the new tests.Trailer sweep (remote shell, rsync 3.5.1 server):
[Receiver];[Receiver], 11;[Receiver], 23;[generator], 23, also with--no-i-r.Tests
All deterministic: every cut is a byte count, never a timer. The one exception is the
--timeoutarm, which waits out the client's own 1 s timeout against a daemon that never sends again.crates/transfer/tests/daemon_pull_unexpected_close_byte_count.rs. The replayed daemon now waits for each client write before its next step, so a reset always lands on a client read. Arms:--timeout=1before and after the fork;keeponce asked. The receiver reads 107 bytes either way; the generator reads 22 without--remove-source-filesand 30 with it (3.5.1's numbers).tests/exit_codes.rs:[Receiver];[generator]) and with nothing listed ([Receiver]).tests/rsh_peer_eof_whine.rs: the mid-transfer pull cut now expects both processes' reports. Generator counts are not pinned over this shim:dd bs=1dribbles bytes, so how much the client has read when it forks depends on scheduling. The first version of the per-file notice test did this and failed 1 run in 8 (73/76/82 for the same cut). The replayed-daemon test above is the deterministic pin.ForkPointframe accounting;ReportingSideroles and the generator follow-up;Mutations, one per fix arm. Each was applied to the committed tree, rebuilt and run against the tests named. All 16 were killed:
PreForkReceiverrendersreceiverlocal_client_rolereturnsReceivermark_fork()removedforward_data(4)removeda_forked_receiver_forwards_sub_lists_and_the_eof_markerforward_data(4 + n)removednote_generator_noticecall removeda_received_file_costs_the_generator_one_notice_under_remove_source_filesinc_recursedropped from the conditioneach_received_file_notifies_the_generator_like_upstreamfinish()never adds itpull_into_an_uncreatable_destination_root_exits_with_file_io--timeoutnot passed ina_silent_daemon_times_out_from_the_process_upstream_namesa_reset_daemon_stream_exits_by_the_phase_it_struckpreceding()not printedserver_error_exit_code_reaches_clientremote_exit_error(.., Receiver)pull_partial_trailer_roleGates:
cargo fmt --all --check, workspace clippy-D warnings,cargo check --target x86_64-pc-windows-gnu, targeted nextest.Known limits
MSG_DATAframe per run between messages. Upstream also starts a new frame whenever perform_io() flushes before blocking on input, which depends on how the sender's bytes arrive. Every fixture measured stays in one frame.MSG_REDO/MSG_NO_SENDin its place, the same 8 bytes, so the model does not tell them apart.safe_read failed to read 35 bytes(12). oc reportsread error(10). The version-exchange read is already tagged (fix: exit 12 when the remote shell dies before the version exchange, as upstream #8283); the negotiation read is not.transfer failed: ...text: upstream prints the per-site rsyserr line, for examplewrite failed on "%s". Only the trailer role and code changed. Task 527.[client]role. Upstream:rsync: [Receiver] failed to connect to H (A): ... (111).MSG_ERROR_EXITupstream prints no trailer of its own (log.c,line < 0); oc still prints one, now with the phase role.NDX_DONEright after the file request; oc had not sent it within a second.Stack
Stacked on #8283 (task 499): the pull arm of its EOF test is this PR's, and it reuses that PR's version-exchange classifier.
Folded in
This PR now also carries #8298 (no exit trailer after the peer's MSG_ERROR_EXIT) and #8302 (handshake reset reported as safe_read, exit 12), merged into this branch so the stack lands in one CI run.