Skip to content

fix: report a failed daemon connection in upstream's words and role - #8303

Closed
oferchen wants to merge 2 commits into
masterfrom
fix/connect-refused-report
Closed

oferchen wants to merge 2 commits into
masterfrom
fix/connect-refused-report

Conversation

@oferchen

@oferchen oferchen commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Rebased onto master after #8287 merged.

Summary

Upstream open_socket_out() (socket.c:464-475) reports every failed address on its own line, failed to connect to <host as given> (<numeric address>): <errno>, from the process that dialled: the lone Receiver for a pull or a module listing, the sender for a push. clientserver.c:164-165 then exits RERR_SOCKETIO. An unresolvable host prints getaddrinfo: HOST PORT: <gai_strerror> with no role (socket.c:403-406), and a --contimeout expiry exits RERR_CONTIMEOUT before any address is reported.

oc printed one line of its own text (failed to connect to 127.0.0.1:PORT: ...) for the last address only, tagged [client], and a module listing printed no cause line at all.

  • try_candidates returns every failed attempt in order; map_connect_failure turns them into upstream's lines.
  • The dialling role is threaded through the connect path: Sender for a push, PreForkReceiver for a pull and for listing.
  • ClientError can carry several program lines; the CLI prints them for transfers and module listings.
  • The getaddrinfo and contimeout arms match upstream's text.

Evidence (rsync 3.5.1 release tarball, same host)

Case 3.5.1 oc after
pull rsync://localhost:<closed> 2 lines (::1, then 127.0.0.1) [Receiver] + error in socket IO (code 10) [Receiver] identical
push to rsync://127.0.0.1:<closed> 1 line [sender] + trailer [sender] identical
listing rsync://127.0.0.1:<closed>/ 1 line [Receiver] + trailer identical
rsync://nonexistent.invalid/... getaddrinfo: nonexistent.invalid 873: Name or service not known + trailer, rc 10 identical
--contimeout=1 to a black-hole address trailer only: timeout waiting for daemon connection (code 35) [Receiver] identical

Tests

  • tests/exit_codes.rs::exit_code_10_socket_io::a_refused_daemon_connection_reports_upstreams_lines (Linux): pull, push and listing against a released loopback port, with exact lines and roles. It replaces three #[ignore]d tests that only asserted "5 or 10"; 3.5.1 exits 10 here, never 5.
  • direct.rs unit tests: every address reported in order with roles; the getaddrinfo line; no address line on a contimeout expiry; try_candidates returns all failures.
  • Mutations, one per arm, all killed: reporting only the last address; tagging a push as Receiver; printing address lines on a contimeout expiry.
  • Gates: check_rustfmt_all.py, workspace clippy -D warnings (two allow(clippy::too_many_arguments) where the role makes 9 arguments, following existing usage in the crate), dead_code_census.py, windows-gnu check of core and cli; core + cli nextest 6880 passed; targeted run including bin exit_codes 309 passed.

Known limits

  • The host in the line is the operand's host after oc's existing IDN-to-ASCII conversion; identical for ASCII hosts (upstream has no IDN step).
  • An IPv6 scope id (fe80::1%eth0) is not printed; upstream's getnameinfo(NI_NUMERICHOST) includes it.

open_socket_out() prints one "failed to connect to %s (%s)" line per
failed address, naming the host as given and the numeric address, from
the process that dialled: the lone Receiver for a pull or a listing,
the sender for a push (socket.c:464-475, clientserver.c:164-165). An
unresolvable host is "getaddrinfo: HOST PORT: <gai_strerror>"
(socket.c:402-406), and a --contimeout expiry exits RERR_CONTIMEOUT
before reporting any address. oc printed one line of its own for the
last address only, as [client].
@oferchen

oferchen commented Nov 4, 2026

Copy link
Copy Markdown
Owner Author

Folded into #8295 (merge commit c81ad75); it lands with that PR.

@oferchen oferchen closed this Nov 4, 2026
oferchen added a commit that referenced this pull request Nov 4, 2026
oferchen added a commit that referenced this pull request Nov 4, 2026
oferchen added a commit that referenced this pull request Nov 10, 2026
oferchen added a commit that referenced this pull request Nov 10, 2026
oferchen added a commit that referenced this pull request Nov 10, 2026
oferchen added a commit that referenced this pull request Nov 10, 2026
oferchen added a commit that referenced this pull request Nov 10, 2026
oferchen added a commit that referenced this pull request Nov 11, 2026
…edule (#8295)

* fix: end the request phase with NDX_DONE right after the last request

Without INC_RECURSE upstream's generator writes the phase-0 NDX_DONE
right after its generate loop (generator.c:2831-2833), before any reply
is read. The receiver now does the same instead of leaving it to the
finalize exchange, reads the sender's answer before the redo pass, and
then drains the hard-link follower echoes that now follow it.

* docs: link the request-phase NDX_DONE entry to #8295

* fix: end the redo and delay phases and send NDX_DEL_STATS on upstream's schedule

* docs: changelog entry for the redo and delay phase ends

* test: pin the phase-end writes in the goodbye and transcript masker tests

* test: the redo phase ends right after its request

* fix: report a failed daemon connection in upstream's words and role

open_socket_out() prints one "failed to connect to %s (%s)" line per
failed address, naming the host as given and the numeric address, from
the process that dialled: the lone Receiver for a pull or a listing,
the sender for a push (socket.c:464-475, clientserver.c:164-165). An
unresolvable host is "getaddrinfo: HOST PORT: <gai_strerror>"
(socket.c:402-406), and a --contimeout expiry exits RERR_CONTIMEOUT
before reporting any address. oc printed one line of its own for the
last address only, as [client].

* docs: link the refused-connection entry to #8303

* fix: itemize the redo request against a fresh destination stat, like upstream's recv_generator

* fix(test-support): accept the pull goodbye only in its two upstream layouts

* test: gate the refused-connection exit-code module to Linux
oferchen added a commit that referenced this pull request Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant