Repository navigation
fix(daemon): default listener to IPv4-only matching upstream - #5908
Merged
Merged
Conversation
1 of 3 tasks
oferchen
force-pushed
the
fix/uts-dd-daemon-exit10-ipv4-default
branch
2 times, most recently
from
June 18, 2026 03:18
6c336e7 to
b9cb579
Compare
The default daemon listener used to bind IPv6+IPv4 (dual-stack) and
treat any per-family accept failure as fatal. On GitHub Actions Linux
runners the IPv6 stack is configured but unreachable: `bind(2)` to
`[::]:873` succeeds, but `accept(2)` then returns a non-routable
address family and the daemon exits 10 ("error in socket I/O") even
though the IPv4 listener was healthy. This matched the upstream
testsuite "daemon (exit 10)" CI-only failure pattern documented under
UTS-DD-daemon-exit10.
Mirror upstream `socket.c::open_socket_in` (rsync-3.4.4:402-499)
semantics by:
- Defaulting to IPv4-only when no `--ipv4`/`--ipv6` flag and no
explicit `--bind` address is given. Matches upstream's
`default_af_hint = 0` behaviour when the IPv6 stack is configured
but unreachable.
- Accepting `--ipv4 --ipv6` together as the explicit dual-stack
opt-in (previously rejected as a CLI conflict). Sets a new
`dual_stack` flag on `RuntimeOptions` so the accept loop binds one
socket per family.
- Tolerating per-family `accept(2)` failures in `run_dual_stack_loop`:
the surviving family keeps serving connections, the failed family
logs a warning. Only a fatal accept on the last surviving family
escalates to daemon exit 10.
- Adding `OC_RSYNC_DAEMON_ADDRESS_FAMILY=ipv4|ipv6|both` as a runtime
override so CI/test fixtures can force a family without rebuilding
the CLI.
The bind-address conflict path is preserved: `--bind 1.2.3.4 --ipv6`
still errors with "cannot use --ipv6 with an IPv4 bind address".
Per-family bind warnings already existed (`warn_per_family_bind_failure`);
this commit adds the companion `warn_per_family_accept_failure` so
runtime accept regressions are auditable too.
upstream: target/interop/upstream-src/rsync-3.4.4/socket.c
- open_socket_in:402-499 - family-iteration bind loop
- start_accept_loop:537+ - per-family `select(2)` survives single
descriptor failure
Tests:
- runtime_options/tests.rs: --ipv4 --ipv6 enables dual_stack;
default has dual_stack=false.
- server_runtime/tests.rs: parse_address_family_env accepts ipv4/ipv6/
both variants; rejects unknown values; warn_per_family_accept_failure
labels IPv4/IPv6.
- crates/daemon/tests/listener_address_family.rs: live daemon end-to-end
with default, --ipv6, --ipv4 --ipv6, and OC_RSYNC_DAEMON_ADDRESS_FAMILY
variants.
Refs: UTS-DD-daemon-exit10.1, UTS-DD-daemon-exit10.2
Two follow-ups to the daemon listener defaults change: 1. `run_single_listener_loop` slept 500ms (`SIGNAL_CHECK_INTERVAL`) between `accept(2)` polls on the non-blocking listener. This was masked previously because the dual-stack default sent traffic through `run_dual_stack_loop`, which uses a 50ms WouldBlock sleep and a 100ms channel `recv_timeout`. Defaulting to IPv4-only single- listener surfaced the latency: the cold-start bench saw 496ms per client vs 115ms upstream (4.3x ratio, regression threshold 1.5x). Lower the single-listener WouldBlock sleep to 50ms so first- connection latency is bounded by the same interval as the dual- stack path. `SIGNAL_CHECK_INTERVAL` is still honoured for the signal-flag inspection at the top of the loop body via `check_signals_and_maintain`. 2. `async_ssh_transport.rs` had two more call sites of `flags::build_wire_format_rules` left un-updated when #5899 added the `delete_excluded: bool` parameter. Pass `config.delete_excluded()` to match the other call sites. No wire/behaviour change; both fixes are mechanical.
oferchen
force-pushed
the
fix/uts-dd-daemon-exit10-ipv4-default
branch
from
June 18, 2026 04:14
d42ddc5 to
6908b0b
Compare
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
* fix(daemon): default listener to IPv4-only matching upstream
The default daemon listener used to bind IPv6+IPv4 (dual-stack) and
treat any per-family accept failure as fatal. On GitHub Actions Linux
runners the IPv6 stack is configured but unreachable: `bind(2)` to
`[::]:873` succeeds, but `accept(2)` then returns a non-routable
address family and the daemon exits 10 ("error in socket I/O") even
though the IPv4 listener was healthy. This matched the upstream
testsuite "daemon (exit 10)" CI-only failure pattern documented under
UTS-DD-daemon-exit10.
Mirror upstream `socket.c::open_socket_in` (rsync-3.4.4:402-499)
semantics by:
- Defaulting to IPv4-only when no `--ipv4`/`--ipv6` flag and no
explicit `--bind` address is given. Matches upstream's
`default_af_hint = 0` behaviour when the IPv6 stack is configured
but unreachable.
- Accepting `--ipv4 --ipv6` together as the explicit dual-stack
opt-in (previously rejected as a CLI conflict). Sets a new
`dual_stack` flag on `RuntimeOptions` so the accept loop binds one
socket per family.
- Tolerating per-family `accept(2)` failures in `run_dual_stack_loop`:
the surviving family keeps serving connections, the failed family
logs a warning. Only a fatal accept on the last surviving family
escalates to daemon exit 10.
- Adding `OC_RSYNC_DAEMON_ADDRESS_FAMILY=ipv4|ipv6|both` as a runtime
override so CI/test fixtures can force a family without rebuilding
the CLI.
The bind-address conflict path is preserved: `--bind 1.2.3.4 --ipv6`
still errors with "cannot use --ipv6 with an IPv4 bind address".
Per-family bind warnings already existed (`warn_per_family_bind_failure`);
this commit adds the companion `warn_per_family_accept_failure` so
runtime accept regressions are auditable too.
upstream: target/interop/upstream-src/rsync-3.4.4/socket.c
- open_socket_in:402-499 - family-iteration bind loop
- start_accept_loop:537+ - per-family `select(2)` survives single
descriptor failure
Tests:
- runtime_options/tests.rs: --ipv4 --ipv6 enables dual_stack;
default has dual_stack=false.
- server_runtime/tests.rs: parse_address_family_env accepts ipv4/ipv6/
both variants; rejects unknown values; warn_per_family_accept_failure
labels IPv4/IPv6.
- crates/daemon/tests/listener_address_family.rs: live daemon end-to-end
with default, --ipv6, --ipv4 --ipv6, and OC_RSYNC_DAEMON_ADDRESS_FAMILY
variants.
Refs: UTS-DD-daemon-exit10.1, UTS-DD-daemon-exit10.2
* fix: lower single-listener accept poll to 50ms; fix async-ssh build
Two follow-ups to the daemon listener defaults change:
1. `run_single_listener_loop` slept 500ms (`SIGNAL_CHECK_INTERVAL`)
between `accept(2)` polls on the non-blocking listener. This was
masked previously because the dual-stack default sent traffic
through `run_dual_stack_loop`, which uses a 50ms WouldBlock sleep
and a 100ms channel `recv_timeout`. Defaulting to IPv4-only single-
listener surfaced the latency: the cold-start bench saw 496ms per
client vs 115ms upstream (4.3x ratio, regression threshold 1.5x).
Lower the single-listener WouldBlock sleep to 50ms so first-
connection latency is bounded by the same interval as the dual-
stack path. `SIGNAL_CHECK_INTERVAL` is still honoured for the
signal-flag inspection at the top of the loop body via
`check_signals_and_maintain`.
2. `async_ssh_transport.rs` had two more call sites of
`flags::build_wire_format_rules` left un-updated when #5899 added
the `delete_excluded: bool` parameter. Pass `config.delete_excluded()`
to match the other call sites.
No wire/behaviour change; both fixes are mechanical.
* fix(clippy): drop unused constant; use io::Error::other
oferchen
added a commit
that referenced
this pull request
Sep 8, 2026
…#7745) The eleven docs that cite SIGNAL_CHECK_INTERVAL were line-accurate when written, but the code moved twice since: PR #5908 lowered the single-listener WouldBlock sleep from 500ms to 50ms and deleted the constant, and PR #7681 replaced accept-side sleep-polling with a readiness wait (poll(2) in PollAcceptEngine, kevent(2) behind the opt-in macos-kqueue feature in KqueueAcceptEngine) in server_runtime/accept_engine.rs. Bring the living documents back in line with the tree: - kqueue-pipeline-audit: mark the two daemon-accept surface rows migrated (KQ-S.1 landed via #6217/#7681) instead of describing the deleted sleep-poll loops as the current implementation. - daemon-tpc-benchmark-plan: bound SIGTERM-to-drain latency by the accept engine's 50ms/100ms signal-check cadence, and mark tracker #1683 completed. - daemon-event-loop-multiplexing: add a status note to the follow-up list and tick #1683, which #5908/#7681 closed. - daemon-thread-per-connection-scalability: mark tracker #1683 completed in the references list. - dis-4a, dis-3, daemon-coldstart-profile, daemon-coldstart-rebench: record that DIS-4.a R1 has since landed, next to the sections that rank it as the top open bottleneck; retarget the DIS-2 file index entry that still pointed the constant at listener.rs. The audit bodies keep their historical line citations: they describe the tree that was measured. daemon-thread-per-connection.md, async-daemon-listener.md (pinned 'Last verified: 2026-05-01'), and daemon-async-listener-rfc.md are left untouched as dated snapshots.
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
The default daemon listener used to bind IPv6+IPv4 (dual-stack) and treat any per-family
accept(2)failure as fatal. On GitHub Actions Linux runners the IPv6 stack is configured but unreachable:bind(2)to[::]:873succeeds, butaccept(2)then returns a non-routable address family and the daemon exits 10 ("error in socket I/O") even though the IPv4 listener was healthy. This matched the upstream testsuite "daemon (exit 10)" CI-only failure pattern documented under UTS-DD-daemon-exit10.This PR mirrors upstream
socket.c::open_socket_in(rsync-3.4.4 lines 402-499) andsocket.c::start_accept_loop(lines 537+) semantics:--ipv4/--ipv6flag and no explicit--bindaddress is given. Matches upstream behaviour whendefault_af_hint = 0collapses toAF_INETon systems where the IPv6 stack is configured but unreachable.--ipv4 --ipv6together as the explicit dual-stack opt-in (previously rejected as a CLI conflict). Sets a newdual_stackflag onRuntimeOptionsso the accept loop binds one socket per family.accept(2)failures inrun_dual_stack_loop: the surviving family keeps serving connections, the failed family logs a warning via the newwarn_per_family_accept_failure(companion to the existingwarn_per_family_bind_failure). Only a fatal accept on the last surviving family escalates to daemon exit 10.OC_RSYNC_DAEMON_ADDRESS_FAMILY=ipv4|ipv6|both(also acceptsv4,inet,dual, etc.) as a runtime override so CI/test fixtures can force a family without rebuilding the CLI.The bind-address conflict path is preserved:
--bind 1.2.3.4 --ipv6still errors with "cannot use --ipv6 with an IPv4 bind address".Upstream reference
target/interop/upstream-src/rsync-3.4.4/socket.c:open_socket_in:402-499- family-iteration bind loop; the daemon binds every getaddrinfo result and only fails when zero sockets bound. The per-familybind() failed: %s (address-family %d)diagnostic is the model for ourwarn_per_family_bind_failure/warn_per_family_accept_failurehelpers.start_accept_loop:537+-select(2)over every successful socket; one busted descriptor does not collapse the loop over the others. Our fix restores the same semantic inrun_dual_stack_loop.The upstream default (
default_af_hint = 0in options.c:155) is "any protocol", which on Linux yields both IPv6 and IPv4 fromgetaddrinfo. On platforms where the IPv6 stack is configured but unreachable, upstream's diagnostic surfaces a per-family error and continues with the surviving family. oc-rsync now does the same, but additionally defaults to IPv4-only when no family is requested to avoid the silent IPv6-then-fail pattern on GitHub Actions runners.Test plan
cargo nextest run -p daemoncovers:runtime_options_tests::ipv4_then_ipv6_enables_dual_stack+ reverse-order companion.runtime_options_tests::dual_stack_default_is_false.parse_address_family_env_accepts_*(ipv4/ipv6/both variant tables).warn_per_family_accept_failure_labels_*.listener_address_family::default_daemon_binds_ipv4_and_serves_ipv4_client(live daemon).listener_address_family::env_override_{ipv4,both}_serves_ipv4_client.listener_address_family::both_family_flags_enable_dual_stack_listener.listener_address_family::ipv6_flag_forces_ipv6_only(probe-skipping on IPv6-less runners).Refs: UTS-DD-daemon-exit10.1, UTS-DD-daemon-exit10.2