Repository navigation
fix: guard the sender exit flush and drop the goodbye finalizer - #8253
Merged
Merged
Conversation
12 of 13 tasks
6 of 7 tasks
The goodbye handshake ran a finalizer between writing the sender's NDX_DONE and reading the receiver's reply. It only called finalize_compression(), which is a plain flush in production: no production path builds a Compressed ServerWriter, since compression is token-level as in upstream token.c. It also ran directly after the flush that follows NDX_DONE, so it could never move a byte. Upstream has no counterpart either. read_ndx_and_attrs() drains output in perform_io() before it blocks, which is the existing flush, and handle_goodbye_proto31_flushes_ndx_done_before_close already guards it. Remove the finalizer parameter from the goodbye methods. The orchestrator's exit flush is what upstream requires: main.c:1011 runs io_flush(FULL_FLUSH) after read_final_goodbye(), and cleanup.c:194-195 flushes again on exit_cleanup(0). That includes the empty-file-list early return at main.c:996-1001. Below protocol 30, send_file_list() leaves the list end and the io_error word buffered, and the multiplex writer has no flushing Drop. Without the flush the client never receives them. A new run()-level test fails with an empty wire when that flush is removed.
kill_process_group on Apple treated EPERM as success only once waitid already reported the leader as ended. A leader that has begun exiting but is not yet waitable is skipped by XNU's killpg1() too, so the EPERM can arrive first, and the test harness's Drop panicked with "stop the test daemon N: Operation not permitted". This was seen on master's macOS tracing row (daemon_pull_default_send_zc_byte_identical) and on the iconv row here. EPERM for our own child now blocks in waitid until the leader has ended, without reaping it. The empty-file-list flush test relied on ENOTDIR from a path through a regular file, which Windows reports as not-found, so no io_error was raised there. Use a missing operand instead. The word is then 0, but the list end plus four io_error bytes still have to reach the wire, and with the early-return flush removed the wire carries no data at all.
XNU's killpg1() (bsd/kern/kern_sig.c) returns EPERM for a POSIX caller whenever it signalled no member of the group. That covers two cases. In the first, the leader is a zombie or is still exiting and not yet waitable. In the second, the leader is alive and the only other member belongs to a different uid. The previous change blocked in waitid(WEXITED|WNOWAIT) on any EPERM for our own child. In the second case the leader never exits, so that wait would hang forever. Now a non-blocking waitid probe first confirms the pid is our own child; any other pid is never signalled and keeps the EPERM error. The leader is then killed directly, which is always permitted on one's own child and harmless on a zombie, and only then awaited without reaping, so the wait has a bounded end. Neither case has a deterministic reproduction: the first is a scheduling window inside process exit, and the second needs a cross-uid group member. Both follow from the killpg1() return rule.
The forking test harnesses call lead_process_group() on both sides of the fork, and the parent's setpgid(child, child) can lose the race. Once the child has exec'd, setpgid() answers EACCES. Once it is exiting, has become a session leader or has left our session, it answers EPERM (xnu kern_prot.c setpgid()). macOS CI hits the EPERM case as "put the test daemon in its own group: Operation not permitted". The child makes the group itself first, so either error now counts as success when getpgid(child) == child. ESRCH from getpgid() means the child ended in between, which is success as it already is for setpgid(). Any other outcome is returned. There are two deterministic tests. Both spawn an exec'd child, so the parent's setpgid() is refused with EACCES: - a child that set its own group before exec is accepted; - a child left in our group is refused. Inverting the getpgid() comparison fails both.
oferchen
force-pushed
the
fix/goodbye-barriers
branch
from
October 28, 2026 22:25
429ee46 to
b5b22a5
Compare
oferchen
added a commit
that referenced
this pull request
Oct 28, 2026
Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
oferchen
added a commit
that referenced
this pull request
Oct 28, 2026
Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
oferchen
added a commit
that referenced
this pull request
Oct 28, 2026
Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
oferchen
added a commit
that referenced
this pull request
Oct 28, 2026
Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
* fix: guard the sender exit flush and drop the goodbye finalizer The goodbye handshake ran a finalizer between writing the sender's NDX_DONE and reading the receiver's reply. It only called finalize_compression(), which is a plain flush in production: no production path builds a Compressed ServerWriter, since compression is token-level as in upstream token.c. It also ran directly after the flush that follows NDX_DONE, so it could never move a byte. Upstream has no counterpart either. read_ndx_and_attrs() drains output in perform_io() before it blocks, which is the existing flush, and handle_goodbye_proto31_flushes_ndx_done_before_close already guards it. Remove the finalizer parameter from the goodbye methods. The orchestrator's exit flush is what upstream requires: main.c:1011 runs io_flush(FULL_FLUSH) after read_final_goodbye(), and cleanup.c:194-195 flushes again on exit_cleanup(0). That includes the empty-file-list early return at main.c:996-1001. Below protocol 30, send_file_list() leaves the list end and the io_error word buffered, and the multiplex writer has no flushing Drop. Without the flush the client never receives them. A new run()-level test fails with an empty wire when that flush is removed. * fix: wait out an exiting leader on macOS killpg; portable flush fixture kill_process_group on Apple treated EPERM as success only once waitid already reported the leader as ended. A leader that has begun exiting but is not yet waitable is skipped by XNU's killpg1() too, so the EPERM can arrive first, and the test harness's Drop panicked with "stop the test daemon N: Operation not permitted". This was seen on master's macOS tracing row (daemon_pull_default_send_zc_byte_identical) and on the iconv row here. EPERM for our own child now blocks in waitid until the leader has ended, without reaping it. The empty-file-list flush test relied on ENOTDIR from a path through a regular file, which Windows reports as not-found, so no io_error was raised there. Use a missing operand instead. The word is then 0, but the list end plus four io_error bytes still have to reach the wire, and with the early-return flush removed the wire carries no data at all. * fix: SIGKILL the leader before awaiting it on a macOS killpg EPERM XNU's killpg1() (bsd/kern/kern_sig.c) returns EPERM for a POSIX caller whenever it signalled no member of the group. That covers two cases. In the first, the leader is a zombie or is still exiting and not yet waitable. In the second, the leader is alive and the only other member belongs to a different uid. The previous change blocked in waitid(WEXITED|WNOWAIT) on any EPERM for our own child. In the second case the leader never exits, so that wait would hang forever. Now a non-blocking waitid probe first confirms the pid is our own child; any other pid is never signalled and keeps the EPERM error. The leader is then killed directly, which is always permitted on one's own child and harmless on a zombie, and only then awaited without reaping, so the wait has a bounded end. Neither case has a deterministic reproduction: the first is a scheduling window inside process exit, and the second needs a cross-uid group member. Both follow from the killpg1() return rule. * refactor: delete the unused stream-compression reader and writer Compression is token-level, as in upstream token.c, so no production path ever wrapped the multiplexed stream in a compressor. Nothing outside tests called ServerWriter::activate_compression*, ServerReader::activate_compression, CompressedWriter or CompressedReader. Delete them, their Compressed variants and match arms, finalize_compression (flush_all_pending is now a flush that tolerates a closed peer), and the tests that existed only to exercise them. ZstdStrategy::with_workers lost its only caller with CompressedWriter, so it goes too; the strategy builds its encoder single-threaded, which is what it already did for every caller.
oferchen
added a commit
that referenced
this pull request
Oct 29, 2026
Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
oferchen
added a commit
that referenced
this pull request
Oct 29, 2026
Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
oferchen
added a commit
that referenced
this pull request
Oct 29, 2026
…clippy (#8256) * docs: drop a public doc link to a private fast_io helper * docs: fix engine rustdoc links to private and feature-gated items * ci: strict per-crate rustdoc, run it on push, add no-default-features clippy * fix(platform): tolerate the macOS setpgid and killpg EPERM races Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
oferchen
added a commit
that referenced
this pull request
Oct 29, 2026
Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
oferchen
added a commit
that referenced
this pull request
Oct 29, 2026
Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
oferchen
added a commit
that referenced
this pull request
Oct 29, 2026
…8250) * fix: create no batch files under --dry-run * fix: write batch .sh filter rules as upstream get_rule_prefix does * fix: reconcile batch flags and batch options as upstream does * fix: write remote batch headers and .sh at setup, byte-exact * fix: refuse a newline batch filter rule and name batch files as upstream * fix: record CF_ID0_NAMES and the id 0 names in local batches * fix: honour --inplace when replaying a batch * fix: send s only on rules after --delete-excluded, as upstream * refactor: delete the dead batch replay engine; test the live path * test: drain compressed batch files whose temp open fails, as upstream * fix(platform): tolerate the macOS setpgid and killpg EPERM races Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
oferchen
added a commit
that referenced
this pull request
Oct 29, 2026
* test: drop uid/gid from the v61d_2 daemon config Upstream calls setgid() for any configured module gid even when the daemon is not root (clientserver.c:844, 1100), so a non-root runner got "@error: setgid failed" and the comment claiming upstream ignores uid/gid without root was wrong. With both unset a root daemon still drops to nobody (clientserver.c:833, 872-873). * fix(platform): tolerate the macOS setpgid and killpg EPERM races Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
oferchen
added a commit
that referenced
this pull request
Oct 29, 2026
…ream (#8258) * test: pin --delete-excluded in the per-segment incremental-recursion delete * fix: let receiver-side rules protect under --delete-excluded, as upstream * docs: cite #8258 in this branch's changelog entry * fix(platform): tolerate the macOS setpgid and killpg EPERM races Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
# Conflicts: # crates/transfer/src/generator/tests.rs # crates/transfer/src/generator/transfer/orchestrator.rs # crates/transfer/src/reader/server.rs
oferchen
added a commit
that referenced
this pull request
Oct 29, 2026
…8262) * fix: refuse --checksum with a none file checksum, exit 4 like 3.5.1 Upstream's file_checksum() has no CSUM_NONE arm. When --checksum asks it for a "none" file checksum, it falls to the default case, prints "Invalid checksum-choice for --checksum: none (0)" and exits RERR_UNSUPPORTED (checksum.c:548-551). The file checksum is the second comma component when one is given, so md5,none is refused and none,md5 is not. oc instead mapped none to MD4 and transferred with exit 0. Only the sender computes file checksums, so the refusal sits where oc is the sender. That is the client for a local copy or a push, and the --server sender for a pull. A pulling client leaves the refusal to the remote sender, like upstream. Every client/server pairing then exits with the code a 3.5.1 client gets from a 3.5.1 server. The new oracle test runs each cell against a real 3.5.1 when one is installed. Mutations that drop the client check, drop the server check, or apply the client check to pulls each fail it. * fix: refuse a none file checksum where upstream's sender sums a file The first cut refused `-c --checksum-choice=none` before the walk, so a source with no regular file exited 4 where 3.5.1 exits 0. It also left an oc daemon sender accepting the combination. Upstream refuses inside file_checksum(). The sender's make_file() calls it for every regular file under --checksum (flist.c:1815-1816). It opens the file first: one that cannot be opened gets a zero sum (checksum.c:426-430). Only then does it reach the default case that refuses `none` (checksum.c:548-551). The refusal now sits at that point on each kind of oc sender: - Network senders, which cover the rsh server, the daemon and a push client. ServerConfig carries the whole-file checksum as file_checksum_choice. ChecksumAlgorithm::parse_file_choice reads it as the part after the first comma, or the whole spec when there is none. compute_flist_checksum refuses once the file has opened, and the walk ends the run on that error (Unsupported, exit 4) instead of skipping the entry. - The rsh server's spec is split the same way, so `md5,none` and `auto,md5` are no longer rejected as unknown names. - A local copy has no file-list pass. It scans the sources for a regular file that opens, with the same descent as the sender, and only when the configuration is the refused one. New oracle cells against 3.5.1: - a source without regular files is copied (exit 0); - a 3.5.1 client pulling from an oc daemon ends as it does from a 3.5.1 daemon; - a push refuses in the local sender with 3.5.1's exit and text; - the pull runs as `md5,none`, so only the file-sum refusal can stop it. An oc client must show the oc server's refusal. Each of these mutations fails a cell: - the generator refusal; - the walk's fatal arm; - the local scan, forced true or bypassed; - the daemon, server and push wiring. A 3.5.1 client pulling from an oc server still exits 4 where 3.5.1 exits 12. Upstream's sender never flushes the MSG_ERROR_EXIT it queues (cleanup.c:250-254, io.c:1073-1075). The oc server's message also does not reach that client's stderr. Both are left to the error-exit work. * fix(platform): tolerate the macOS setpgid and killpg EPERM races Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
oferchen
added a commit
that referenced
this pull request
Oct 29, 2026
* fix: honour --parallel-delta-scan on remote-shell pushes * refactor: remove the counter-dropping generate_chunked wrapper * docs: changelog for the remote-shell parallel-delta-scan fix * fix(platform): tolerate the macOS setpgid and killpg EPERM races Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
oferchen
added a commit
that referenced
this pull request
Oct 29, 2026
… hangs (#8264) * test: pull wide and deep trees under incremental recursion, reporting hangs * fix(platform): tolerate the macOS setpgid and killpg EPERM races Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
oferchen
added a commit
that referenced
this pull request
Oct 29, 2026
…8252) * fix(matching): report upstream's hash_hits and false_alarms counters The -vv total: line printed oc-native probe counts: bithash positives and their verify failures. upstream defines both by its own hash_table (match.c:84-110 build_hash_table, 214-271 hash_search): hash_hits is one per probed offset whose bucket is non-empty, false_alarms one per chain candidate whose weak sum matches but whose strong sum does not. On a 200,000-line delta oc printed 1262/120 locally and 1130/1129 on the wire against upstream's 1165/0. UpstreamHashTable rebuilds that table and walks its chains at every offset upstream probes, including the shrinking-window offsets past the last full window and the --inplace chain pruning. Every sequential scan (local engine, wire sender, consecutive-match scan) feeds it, but only while DEBUG_GTE(DELTASUM, 1) reports the counters, and the parallel chunked scan is not chosen then. matches and data were already exact. * ci: run the delta total line oracle in the interop job * docs: link the total: line CHANGELOG entry to #8252 * docs: point the hash-table citations at their 3.5.1 match.c lines * test: pin MD5 in the redo total-line cell and leave out its local copy * test: fix the checksum seed for every total-line cell * style: rustfmt and clippy after the rebase onto sender buffer reuse * fix(platform): tolerate the macOS setpgid and killpg EPERM races Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop failing on the master test-harness race: on EPERM for our own child, SIGKILL the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the child already leads its own group. The content is identical to #8253, so the two merge without conflict.
oferchen
added a commit
that referenced
this pull request
Nov 12, 2026
## Summary - **Root cause of the core daemon-test flake:** core and transfer tests ran the oc-rsync daemon by executing the 126 MB debug binary on a probed free port. They then polled for readiness under a wall-clock bound and retried when the port was lost. On a loaded host a cold page-in kept the process in state D (`folio_wait_bit_common`) for 10-34 s before its first log line, so the 5 s readiness bound failed sessions that would have succeeded. - **One harness in test-support, with no clock in it:** - `forked_server::ForkedServer` forks a closure through `platform::session_fork`'s safe API, records how the run ended, and kills and reaps its process group on drop. It can capture the server's stderr through a pipe, using the new `platform::session_fork::redirect_stderr` (nix `dup2_stderr`). - `oc_daemon::OcDaemon` (feature `daemon`) binds `127.0.0.1:0`, and with `.quic()` a UDP `127.0.0.1:0` socket too, before the fork, then runs `daemon::run_daemon` on those sockets. A client connect queues in the backlog: no port probe, no readiness wait, no retry, and no exec. - `inetd_server::InetdServer` serves upstream binaries, which cannot take a pre-bound socket, in inetd mode: one process per accepted connection, with the socket as stdin/stdout. upstream: clientserver.c:1748 `is_inetd_socket()`. - **Every daemon test uses it:** - The daemon crate's own `DaemonHandle` is a thin adapter over `ForkedServer`. - Core's `TestDaemon`, all 27 transfer daemon tests and the five root-crate daemon tests use `OcDaemon` or `InetdServer`. - `DaemonProcess`, `spawn_daemon_on_free_port`, `daemon_listen_port` and their tests go with their last callers. - The QUIC parent-thread and certificate-matrix tests now wait on daemon log lines instead of polling a log file. - **Only production change:** `DaemonConfigBuilder::pre_bound_quic_socket`, the UDP twin of `pre_bound_listener`. Injected sockets replace the daemon's own QUIC bind, so no test races another process for a UDP port. ### Deleted tests (property pinned elsewhere) - `uts_nextest_daemon_gzip_zz::second_daemon_on_the_same_port_is_refused_no_co_bind`. With a pre-bound fixture listener it cannot fail. The daemon unit test `default_single_listener_refuses_a_second_bind_on_the_same_port` pins the same SO_REUSEADDR-only rule through the production `bind_listeners_per_family`. - `quic_daemon_address.rs`. Its property is the daemon's own `quic address` bind, which a pre-bound socket bypasses, and no race-free port exists for the daemon to bind itself (`quic port = 0` means 873). The unit tests in `server_runtime/tests.rs` pin `resolve_quic_bind_addresses` and `bind_quic_sockets_per_family` for explicit address lists. ### Other changes - `concurrent_fixtures_get_distinct_ports_and_do_not_cross_talk` forks every fixture on the main thread before any client thread exists. - `client_daemon_interop::test_client_incremental_transfer` backdates its first copy. A same-second rewrite of an equal-length file was skipped by the quick check; the slow old harness used to hide that. - Workspace builds now link `bstr` (via the daemon feature's engine/globset path) into every test target that depends on test-support. Its `impl AsRef<BStr> for [u8]` made `x.as_ref()` inference ambiguous at 10 sites in `rsync_io` and `checksums`; those bindings now name `&[u8]` / `&mut [u8]` explicitly. No behaviour change. ## Test plan - [x] `cargo nextest run -p core --all-features --retries 0`, 5 runs: 2938/2938 each. - [x] `cargo nextest run -p daemon --all-features --retries 0`, 5 runs: 2144/2144 each. - [x] The 27 migrated transfer binaries at `--retries 0`, 5 runs: 110/110 each. QUIC binaries alone: 35/35. - [x] Core run with the oc-rsync client binary's pages evicted (`posix_fadvise DONTNEED`) every second for the whole run: 2938/2938. A single cold client exec measured 3.59 s, against 0.01 s hot; the client is bounded only by its own `--timeout`. - [x] Upstream inetd path against a real upstream daemon (`/usr/bin/rsync` 3.5.1 standing in for the pinned versions): - client_daemon_interop: 21/25. The 4 failures are 2 absent pinned versions and 2 version-specific expectations. - daemon_client_interop + upstream_client_to_oc_daemon: 41/42. The 1 failure is a version-specific expectation. - [x] Mutation: when the daemon ignores the injected UDP socket and binds its own, the certificate matrix fails. - [x] After rebasing onto master: `cargo nextest run -p core -p daemon -p transfer -p test-support -p rsync_io -p checksums -p bin --all-features --retries 0`: 11768/11768. - [x] Gates: - `cargo fmt --all -- --check` and `check_rustfmt_all.py`. - `cargo clippy --workspace --all-targets --all-features --no-deps -- -D warnings`. - clippy all-features all-targets, and no-default-features `--tests`, for test-support, core, transfer, daemon and platform. - `cargo check --target x86_64-pc-windows-gnu --tests` for the same crates. - `unsafe_owner_deps.py`, `dead_code_census.py`, `xtask no-placeholders`. - rustdoc-links in both feature sets. - [ ] CI: fmt + clippy, nextest (stable), Windows, macOS, Linux musl. ### Findings, not fixed here (filed as tasks) - The uts_9 goodbye barriers are unguarded (now #8253). - `v61d_2_daemon_push_increcurse_perf_regression` fails for any non-root runner once upstream is installed: `gid = nobody` makes upstream call setgid (clientserver.c:844, 1100), contrary to the test's comment (separate PR). - Residual wall-clock waits outside the harness: the core kill tests' 20 s polled progress wait (filed separately), and `msg_no_send_unsendable_file`'s client deadline loop. ## Coordination - Follows #8247 (merged); based on master. - Related: unblocks removing the remaining nextest retries. ## Conventional commit prefix `test:` ## Pre-merge checklist - [x] Conventional commit prefix on PR title matches the change category. - [x] `cargo fmt --all` run locally. - [x] `CHANGELOG.md`: not updated, because only tests and test infrastructure change. The one production addition is a test-only daemon config hook. - [x] No references to internal tooling or non-human authoring aids; hyphens, not em-dashes. ## Folded in - #8259 (task 471): drop the last nextest retries and serial test groups. Merged into this branch so one CI run lands both. Five green passes each of the root integration_daemon binaries and engine execute_sparse|buffer_pool. ## Folded in - #8322 (tasks 298 and 481): clock-seam handshake test and event-driven kill-test waits; adds the dev-only notify dependency. ### Root daemon tests: reserved listeners, no readiness polls (task 538) The 21 root `tests/` files that spawned `oc-rsync --daemon` and polled `connect()` under a 30 s ready timeout now get a listener that is bound before the daemon runs. A connect therefore queues in the kernel backlog, and no test waits for readiness. **InetdServer** (`test_support::inetd_server`): the real binary serves each accepted socket in inetd mode (upstream clientserver.c:1748). It's used where the test needs the shipped binary's daemon behaviour, or serves upstream 3.5.1 too: - log file / log format: daemon_transfer_logging_per_file, daemon_log_file_escaping, daemon_log_host_rendering, server_diagnostics_reach_client - chroot, name converter, privilege: daemon_chroot_identity_resolution, daemon_name_converter_unknown_answer, daemon_module_under_private_parent (run as root through `wrapped_by(sudo -n ...)`) - confinement and path handling: daemon_concurrent_module_confinement, daemon_served_module_root_operator_paths, daemon_dest_root_symlinked_tail, daemon_operand_metacharacters - remove-source-files: daemon_honours_forwarded_remove_source_files, remove_source_files_failure_exit_23 - filters and hosts: daemon_filter_file_whitespace_is_pattern_text, daemon_hosts_allow_sentinel - oc and 3.5.1 sender legs: client_empty_flist_skips_recv_loop, missing_source_arg_exits_partial, daemon_sender_per_file_error_no_hang, flist_banner_before_names **OcDaemon** (`test_support::oc_daemon`), which forks the daemon library onto a reserved listener. It's used for the two tests about daemon startup itself: - daemon_operator_path_symlinks: a refused config exits and closes the listener, which the test detects with a greeting probe and then `join()` - log_file_created_with_upstream_mode, with umask pinned to 0 around the spawn Harness additions: `InetdServer::finish()` stops accepting and waits for every session to exit, so a session's log lines are on disk before the test reads them. This replaces the kill-then-read races and the log-file polls. Also new: `reserve_port()` / `start_reserved()`, `OcDaemonBuilder::reserved_port()` for a port that must be written into a config first, and `InetdCommand::{discarding_stderr, wrapped_by, env}`. Client-side wall-clock loops removed: client_empty_flist_skips_recv_loop, daemon_sender_per_file_error_no_hang, missing_source_arg_exits_partial and flist_banner_before_names now block on the client via `Command::output()`. The nextest per-test timeout is the only bound, so a hang under test fails as a TIMEOUT that names the test. client_empty_flist_skips_recv_loop and missing_source_arg_exits_partial are now `#![cfg(unix)]`: `oc-rsync --daemon` does not run on Windows. Assertions on daemon stderr and log files are byte-identical. daemon_transfer_logging_per_file now also asserts, after `finish()`, that the log contains the marker line it used to poll for. Mutation checks, one per family, each reverted afterwards: - logging: op name `"send"` -> `"sendX"` (log_format.rs): daemon_transfer_logging_per_file 5/29 FAIL - confinement: `insecure_links` default -> true (module_definition/finish.rs): daemon_concurrent_module_confinement 2/3 FAIL, strict_alone_is_confined and the concurrent case - remove-source-files: forwarded `--remove-source-files` dropped (client_args/long_form_args.rs): daemon_honours_forwarded_remove_source_files 1/1 FAIL Two tests that merged after this PR was written used the deleted `DaemonProcess`. They now use the harness: crates/test-support/tests/receiver_write_failure.rs (#8304) uses `OcDaemon` with `--once`, gated on the `daemon` feature; crates/transfer/tests/push_list_only_reaches_client.rs serves oc or 3.5.1 through `InetdServer`. Also, crates/daemon/src/tests/chunks/run_daemon_serves_slow_handshake.rs is now rustfmt-clean. It is include!d, so `cargo fmt --all` never reached it, but check_rustfmt_all did. Left in place: daemon_operator_path_symlinks still polls journald for up to 5 s for its syslog line. It reads an external system log; task 584 tracks it. ### Daemon listener address families, tested in process (task 612) The five `listener_address_family` tests started a daemon on a port reserved by binding then dropping a probe, then retried `connect`. Another process could take the port in between; #8321's macOS run hit exactly that. Upstream's testsuite has no daemon-level family test: its daemon tests use `RSYNC_CONNECT_PROG` and open no listener at all (testsuite/rsyncfns.py:833-865). So this PR drops those daemon-process tests and tests the family selection in process instead. No production code changes. - `crates/daemon/tests/listener_address_family.rs` is removed. - Five cells in `server_runtime/tests.rs` run the daemon's own path: `RuntimeOptions` parsing, then `resolve_bind_addresses`, then `bind_listeners_per_family` at port 0, with no daemon process and no readiness wait. The `OC_RSYNC_DAEMON_ADDRESS_FAMILY` override is passed as a value rather than through the environment. The IPv6 cells skip, with a reason, when `::1` cannot bind. - Mutation checks: making dual-stack resolve to IPv4 only fails `both_family_flags_bind_both_families`, and making the IPv4 override bind IPv6 fails `ipv4_override_binds_only_ipv4`. ### Last readiness polls in the root tests (task 538) - `tests/daemon_session_error_keeps_listener.rs`: the 15 s connect-retry loop and socket timeouts become a single connect against the pre-bound listener. The 500 ms sleep is removed with no new seam: sessions are forked children, so a session error cannot reach the accept loop, and the first client's read-to-EOF already waits for its session to end. - `tests/integration_daemon.rs` loses a dead 30 s `connect_with_retries`, a reserve-then-release `allocate_test_port` and two dead protocol helpers. `daemon_list_modules_via_cli` never started a daemon; it now serves two modules from an `OcDaemon` and asserts the exact `(name, comment)` rows of `--list-only rsync://.../`. - Mutation checks: dropping comments from the listing fails `daemon_list_modules_via_cli`; a daemon that binds and never accepts fails both tests in under a second, not at a timeout. Left as is: the journald poll in `daemon_operator_path_symlinks` (task 584), the public-server polls in `integration_rsync_protocol.rs`, and `tests/compress_interop_test.sh` (shell harness outside nextest).
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
Two flush barriers in the server sender's exit path had no test: removing either one left every test green. Upstream shows which one is required.
flush_all_pendingexit flush. It mirrorsmain.c:1011(io_flush(FULL_FLUSH)afterread_final_goodbye()) andcleanup.c:194-195(the flush on a cleanexit_cleanup(0)). That includes the empty-file-list early return atmain.c:996-1001.send_file_list()leaves the list end and the io_error word buffered, because on the normal pathmain.c:1398flushes them later.Drop. Without this flush the client never receives those bytes.empty_file_list_early_return_flushes_the_io_error_worddrivesGeneratorContext::runat protocol 29 with an ENOTDIR operand. It decodes the wire and expects exactly[end marker, io_error LE].left: [],right: [0, 1, 0, 0, 0]).finalize_between_write_and_readhook in the goodbye handshake.finalize_compression(). In production that is a plain flush: no production path builds aCompressedServerWriter, because compression is token-level, as in upstreamtoken.c.NDX_DONE, so it could never move a byte.read_ndx_and_attrs()drains output inperform_io()before it blocks, and that maps to the existing flush.handle_goodbye_proto31_flushes_ndx_done_before_closealready guards it: removing that flush fails the test.handle_goodbye,answer_goodbye(renamed fromanswer_goodbye_with_finalizer) andgoodbye_draining_source_removals. Its ordering test is deleted with it.Not covered by a failing test: the post-goodbye site of the same exit flush. In the current writer graph nothing can still be buffered at that point. The
NDX_DONEwrite flushes, and the during-goodbye drain only emitsMSG_ERROR_XFER, which flushes immediately. It stays as themain.c:1011mirror, and no behavioural test can fail without it today.Test plan
cargo fmt --all -- --check;cargo clippy -p transfer -p daemon --all-targets --all-features --no-deps -- -D warningscargo nextest run -p transfer -p core --all-features: 6221/6221uts_v3_a_drain_barrier: 919/919Conventional commit prefix
fix:Pre-merge checklist