Skip to content

fix: print a failed exit wait after the client's error trailer - #8362

Merged
oferchen merged 1 commit into
fix/error-exit-echo-drainfrom
fix/client-trailer-before-wait
Nov 11, 2026
Merged

oferchen merged 1 commit into
fix/error-exit-echo-drainfrom
fix/client-trailer-before-wait

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Stacked on #8357 (base fix/error-exit-echo-drain); it retargets to master once #8357 lands.

Summary

On a client, rsync 3.5.1's _exit_cleanup() calls log_exit() before noop_io_until_death() (cleanup.c:221-253). So when the wait for the daemon's exit fails, its read error (io.c:918-925) or io timeout (io.c:261-262) line comes after the client's own rsync error: trailer. oc printed it from inside the transfer, before core built the trailer.

  • transfer:
    • drain_until_peer_exits returns an ExitWaitFailure: ReadError("[who] read error: ...") or Timeout("[who] io timeout ...").
    • A daemon server still logs it through log_line(), which adds the rsync: prefix.
    • A client returns it wrapped behind the error that ended the transfer (after_exit_wait). The wrapper keeps that error's kind.
  • core: map_server_transfer_error splits the wait off with transfer::split_exit_wait. It classifies the error exactly as before (classify_server_transfer_error) and attaches the line to the ClientError (followed_by_exit_wait).
  • cli: emit_error_report prints that line after the trailer, and also when the trailer is suppressed after a peer's MSG_ERROR_EXIT.
    • A read error gets the brand prefix, like program_line (log.c:483-500).
    • A timeout prints as-is.

Evidence

Replayed daemon at protocol 31 against the 3.5.1 tarball build. The daemon sends a one-entry file list, the client's destination-root mkdir fails, and the daemon reads the client's MSG_ERROR_EXIT and resets the connection.

3.5.1 prints:

rsync: [Receiver] mkdir ".../ro/inner" failed: Permission denied (13)
rsync error: error in file IO (code 11) at main.c(821) [Receiver=3.5.1]
rsync: [Receiver] read error: Connection reset by peer (104)

oc now prints the same three lines in the same order. Before, the read error line came first.

  • Line order: a_failed_wait_for_the_daemon_prints_after_the_trailer (crates/transfer/tests/daemon_pull_unexpected_close_byte_count.rs, Linux) pins it, keyed on frame bytes and the reset.
  • Split round-trip: a unit test checks that the wrapped error splits back intact: same kind, same text, and a raw OS error passes through.
  • Mutants, each killed by the line-order test:
    • The transfer prints the line itself again.
    • Core drops the line.
    • The cli prints the line before the trailer.

Residuals

Test plan

  • python3 tools/ci/check_rustfmt_all.py
  • Workspace clippy with all features, plus no-default-features clippy of transfer, core and cli
  • cargo nextest run -p transfer --all-features (daemon_pull_unexpected_close_byte_count, error_exit): 29 passed
  • cargo nextest run -p core -p cli --all-features (daemon, summary, error, exit filters): 992 passed
  • 3.5.1 oracle: the replayed-daemon line order above

On a client, 3.5.1's _exit_cleanup() calls log_exit() before
noop_io_until_death() (cleanup.c:221-253). So when the wait for the
daemon's exit fails, its `read error` or `io timeout` line comes after
the `rsync error:` trailer of the failure that started it.

oc printed the wait's line from inside the transfer, before core built
the trailer.

The transfer now carries the failed wait out behind the error that
ended it. Core splits the two apart, classifies the error as before,
and attaches the wait's line to the report. The CLI prints that line
after the trailer: with the program-name prefix for a read error
(log.c:483-500), and as-is for a timeout.

Task 639.
@oferchen
oferchen force-pushed the fix/client-trailer-before-wait branch from 0b7022e to c72bead Compare November 10, 2026 21:59
@github-actions github-actions Bot added the bug Something isn't working label Nov 10, 2026
@oferchen
oferchen merged commit b7eaa5d into fix/error-exit-echo-drain Nov 11, 2026
17 checks passed
@oferchen
oferchen deleted the fix/client-trailer-before-wait branch November 11, 2026 06:11
oferchen added a commit that referenced this pull request Nov 11, 2026
On a client, 3.5.1's _exit_cleanup() calls log_exit() before
noop_io_until_death() (cleanup.c:221-253). So when the wait for the
daemon's exit fails, its `read error` or `io timeout` line comes after
the `rsync error:` trailer of the failure that started it.

oc printed the wait's line from inside the transfer, before core built
the trailer.

The transfer now carries the failed wait out behind the error that
ended it. Core splits the two apart, classifies the error as before,
and attaches the wait's line to the report. The CLI prints that line
after the trailer: with the program-name prefix for a read error
(log.c:483-500), and as-is for a timeout.

Task 639.
oferchen added a commit that referenced this pull request Nov 11, 2026
On a client, 3.5.1's _exit_cleanup() calls log_exit() before
noop_io_until_death() (cleanup.c:221-253). So when the wait for the
daemon's exit fails, its `read error` or `io timeout` line comes after
the `rsync error:` trailer of the failure that started it.

oc printed the wait's line from inside the transfer, before core built
the trailer.

The transfer now carries the failed wait out behind the error that
ended it. Core splits the two apart, classifies the error as before,
and attaches the wait's line to the report. The CLI prints that line
after the trailer: with the program-name prefix for a read error
(log.c:483-500), and as-is for a timeout.

Task 639.
oferchen added a commit that referenced this pull request Nov 11, 2026
On a client, 3.5.1's _exit_cleanup() calls log_exit() before
noop_io_until_death() (cleanup.c:221-253). So when the wait for the
daemon's exit fails, its `read error` or `io timeout` line comes after
the `rsync error:` trailer of the failure that started it.

oc printed the wait's line from inside the transfer, before core built
the trailer.

The transfer now carries the failed wait out behind the error that
ended it. Core splits the two apart, classifies the error as before,
and attaches the wait's line to the report. The CLI prints that line
after the trailer: with the program-name prefix for a read error
(log.c:483-500), and as-is for a timeout.

Task 639.
oferchen added a commit that referenced this pull request Nov 11, 2026
On a client, 3.5.1's _exit_cleanup() calls log_exit() before
noop_io_until_death() (cleanup.c:221-253). So when the wait for the
daemon's exit fails, its `read error` or `io timeout` line comes after
the `rsync error:` trailer of the failure that started it.

oc printed the wait's line from inside the transfer, before core built
the trailer.

The transfer now carries the failed wait out behind the error that
ended it. Core splits the two apart, classifies the error as before,
and attaches the wait's line to the report. The CLI prints that line
after the trailer: with the program-name prefix for a read error
(log.c:483-500), and as-is for a timeout.

Task 639.
oferchen added a commit that referenced this pull request Nov 11, 2026
On a client, 3.5.1's _exit_cleanup() calls log_exit() before
noop_io_until_death() (cleanup.c:221-253). So when the wait for the
daemon's exit fails, its `read error` or `io timeout` line comes after
the `rsync error:` trailer of the failure that started it.

oc printed the wait's line from inside the transfer, before core built
the trailer.

The transfer now carries the failed wait out behind the error that
ended it. Core splits the two apart, classifies the error as before,
and attaches the wait's line to the report. The CLI prints that line
after the trailer: with the program-name prefix for a read error
(log.c:483-500), and as-is for a timeout.

Task 639.
oferchen added a commit that referenced this pull request Nov 11, 2026
On a client, 3.5.1's _exit_cleanup() calls log_exit() before
noop_io_until_death() (cleanup.c:221-253). So when the wait for the
daemon's exit fails, its `read error` or `io timeout` line comes after
the `rsync error:` trailer of the failure that started it.

oc printed the wait's line from inside the transfer, before core built
the trailer.

The transfer now carries the failed wait out behind the error that
ended it. Core splits the two apart, classifies the error as before,
and attaches the wait's line to the report. The CLI prints that line
after the trailer: with the program-name prefix for a read error
(log.c:483-500), and as-is for a timeout.

Task 639.
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