Skip to content

fix: print no exit trailer after the peer's MSG_ERROR_EXIT - #8298

Merged
oferchen merged 2 commits into
fix/pull-trailer-role-and-daemon-exit-classfrom
fix/peer-error-exit-no-trailer
Nov 3, 2026
Merged

oferchen merged 2 commits into
fix/pull-trailer-role-and-daemon-exit-classfrom
fix/peer-error-exit-no-trailer

Conversation

@oferchen

@oferchen oferchen commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Stacked on #8287 (both change the client error mapping). Retarget to master once #8287 merges.

Summary

When the peer ends a run with MSG_ERROR_EXIT, upstream exits through _exit_cleanup(val, __FILE__, 0 - __LINE__) (io.c:1930). The negative line keeps log_exit() quiet (cleanup.c:221-225) because the peer has already reported the failure. oc exited with the right code but added its own trailer, for example oc-rsync error: error in file IO (code 11) ... [sender=...] after the server's own lines.

Upstream keeps one exception: a --log-file run without INFO_GTE(STATS, 1) still calls log_exit(); -v sets that level (options.c:257). oc mirrors the exception.

  • ClientError records that the run ended on the peer's MSG_ERROR_EXIT (peer_error_exit_error, used by the rsh and daemon mapping sites).
  • The CLI skips the trailer, unless --log-file is set and neither -v nor --info=stats is.

Evidence (rsync 3.5.1 release tarball build)

Case 3.5.1 client oc before oc after
push over rsh into a 3.5.1 server, uncreatable dest server's 2 lines, rc 11 + oc-rsync error: ... (code 11) ... [sender], rc 11 server's 2 lines, rc 11
replayed daemon sends MSG_ERROR_EXIT(11) before the list nothing, rc 11 trailer, rc 11 nothing, rc 11
same, --log-file rsync error: error in file IO (code 11) at io.c(1930) [Receiver=3.5.1] trailer trailer
same, -v --log-file banner only trailer banner only

Tests

Two replayed-daemon tests in daemon_pull_unexpected_close_byte_count.rs:

  • No trailer, with and without -v: exit 11 and no (code 11) line.
  • --log-file: a trailer without -v, none with -v.

Mutations, one per arm, all killed: leaving the flag unset fails both tests; removing the --log-file exception fails the second.

Gates: check_rustfmt_all.py and workspace clippy -D warnings clean; windows-gnu check of core and cli clean; core + cli nextest 6878 passed; targeted transfer tests 7/7.

Not in this PR

  • oc writes nothing to --log-file on a failed run; upstream logs the trailer there too (task 543).
  • Upstream's protocol >= 31 echo of MSG_ERROR_EXIT and the drain until the peer exits (task 232).
  • 3.5.1 as the client hangs against a replay that sends MSG_ERROR_EXIT after the file request, so the tests send it before the list, where 3.5.1 exits cleanly.

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.
@github-actions github-actions Bot added the bug Something isn't working label Nov 3, 2026
@oferchen
oferchen merged commit 7fe4f6a into fix/pull-trailer-role-and-daemon-exit-class Nov 3, 2026
0 of 2 checks passed
@oferchen
oferchen deleted the fix/peer-error-exit-no-trailer branch November 3, 2026 09:36
oferchen added a commit that referenced this pull request Nov 3, 2026
…e and error class (#8287)

* fix: report pull failures from upstream's process and exit by class

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).

* docs: link the pull failure report entry to #8287

* chore: drop the dead-code allowlist row for the now-called serve

* fix: print no exit trailer after the peer's MSG_ERROR_EXIT

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.

* docs: link the peer error-exit entry to #8298

* fix: report a handshake reset as safe_read's failure, exit 12

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.

* docs: link the handshake reset fix to its PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant