Repository navigation
test(daemon): run the module filter-directive tests un-detached - #7588
Conversation
All three tests in tests/integration_daemon_filter_directives.rs started the daemon without --no-detach. RuntimeOptions::detach defaults to cfg!(unix), so run_daemon reached become_daemon() in the accept loop and the fork's parent - the test binary - exited 0 before any assertion ran. An unconditional panic! placed immediately after the daemon spawn still reported "3 tests run: 3 passed"; the tell was a 0.029s runtime for three full TCP transfers. Making them execute surfaced a second defect the vacuity had masked. The tests checked only that run_client returned Ok. A daemon-refused push does not return Err: generator.c:1669-1671 reports the refusal as FERROR_XFER, log.c:337-338 sets got_xfer_error on receipt, and cleanup.c:217-218 lifts the exit status to RERR_PARTIAL, which arrives on ClientSummary::io_error_exit_code rather than as an error. The push's actual status was therefore never asserted, and an absent .log file on its own is equally consistent with a transfer that achieved nothing - so each test now asserts exit 23 as the positive signal that the module directive fired. collect_files carries file contents alongside the names so a kept file has to arrive intact rather than merely exist, and the module header's upstream citations are moved onto the 3.5.0 pin (clientserver.c:934-951, receiver.c:889, generator.c:1663). Mutation-proved on both assertions: silencing the FERROR_XFER frame in receiver/transfer/candidates.rs leaves the on-disk state correct and reddens only the new exit-code assertion, while disabling the daemon filter check reddens the exclusion assertions with all four files landing. The no-detach guard grows a fourth check for root-level integration tests, which live outside the daemon crate and cannot reach its test-support helpers, with a shrink-only ceiling at the 2 files still to be migrated.
) All 25 tests in tests/integration_daemon_server.rs started their daemon without --no-detach, so run_daemon reached become_daemon() and the fork's parent - the test binary - exited 0 before any assertion ran. The window is not the spawn: thread::spawn returns before the daemon thread reaches the fork, so a panic! placed straight after it still fires. It is the first blocking socket call. With 14 unconditional panics placed after connect_with_retries, all 25 tests still reported PASSED. Making them execute surfaced four defect classes, none of which could have been seen before: 1. Greeting. Nine sites sent a bare `@RSYNCD: 32.0`. The digest name list is mandatory above protocol 31 (clientserver.c:229-241), so every probe was refused before reaching the feature under test. Five more sites jumped straight to `#list`, but exchange_protocols() runs at clientserver.c:1534 and the command line is only read at :1538. 2. Listing shape. Six tests expected a CAP line and an OK line before the module rows. send_listing() (clientserver.c:1374-1386) writes rows then `@RSYNCD: EXIT` and nothing else, so those reads consumed the real rows. In two tests the follow-on loop then spun on end-of-file rather than ending, turning a wrong expectation into a hang. 3. Assertions that could not fire. server_lists_modules_with_comments guarded its only assertions behind `if line.contains('\t')`, reached with an empty line, and so asserted nothing even once executing; server_enforces_max_connections hid the entire cap probe behind `if line.contains("OK")`; server_handles_invalid_greeting_response guarded on `result.is_ok() && !line.is_empty()`. Each is now unconditional and pinned to the upstream payload. 4. Expectations upstream does not have. `@RSYNCD: EXIT` has exactly one producer upstream (send_listing, clientserver.c:1385); the unknown-module arm at :1567-1572 writes the error and drops the connection, so server_sends_exit_after_error is renamed to server_closes_connection_after_error and asserts EOF. auth_flow_protocol_29_md4_succeeds computed plain MD4 where a client that advertises no list lands on CSUM_MD4_OLD (compat.c:888-891); oc is correct and the test encoded the wrong digest. The auth cases also never negotiated anything: perform_auth_handshake took a digest argument, used it for the client's own arithmetic, and advertised no list, so the daemon stayed on the md5 fallback. It now advertises the digest under test above protocol 31. Mutation-proved across three classes: dropping the listing comment reddens only server_lists_modules_with_comments (which previously asserted nothing); altering the max-connections payload reddens only server_enforces_max_connections; ignoring the client's advertised digest list reddens the sha512 and sha256 cases while md5 stays green, because md5 is the fallback the old fixture silently relied on. The no-detach guard ceiling drops to 1, leaving tests/integration_daemon_max_connections_cap.rs.
Resolves tools/ci/check_daemon_no_detach.sh: master and this branch added the same check 4 with different ceilings (2 vs 1). Both are now stale - every root test that calls run_daemon() passes --no-detach, so the measured count is 0. Ceiling set to 0, which is what makes the guard bite for a new test that forgets the flag.
|
CI red triage — evidence, not yet a root cause. The failing test is in a file this PR does not touch. Two Linux cells failed identically on
Both on the same single test, with the same message: Three things worth separating before anyone reaches for a fix. 1. The assertion text names a handshake desync, not a plain mismatch. The module name the server reports is 2. It is NOT deterministic on this commit, and that is the load-bearing observation. Five sibling Linux cells ran the same test on the same commit and passed: 3. That is a hypothesis, not a conclusion. The measurement that would settle it is whether ⚠ Two caveats on the numbers above:
|
|
This PR is EXONERATED. The red is a master defect, and my earlier triage on this PR was wrong on both counts — retracting it. I previously wrote that the failure looked like a handshake desync caused by cross-test interference from un-detached daemons, and that the 5-pass/2-fail split across sibling cells made it a race. Both claims are refuted below. The mechanism is deterministic and has nothing to do with this PR. What actually happens
Line 1 is the version echo. Line 2 is intended to re-drive Master no longer does that. // upstream: clientserver.c:1534-1538 start_daemon() - the version line is read
// exactly once, by exchange_protocols(); the very next read_line_old() is the
// request line whatever it contains. A second `@RSYNCD:` banner is therefore a
// module name, not a re-greeting, and falls through to the unknown-module
// refusal. Taking the Greeting -> ModuleSelect edge again instead would fail the
// FSM's ordering check, and a session error is fatal to the whole listener
// (workers.rs join_worker), so a peer could end the daemon with two greeting lines.
Ok(LegacyDaemonMessage::Version(_)) => {}So the daemon answers Why it landed green and only surfaces now
The arm merged 2h30m before the test. But #7590's tested head ( It is not this PR, and not only this PR
The "5 siblings passed" observation I leaned on earlier does not establish a race: those cells are a different feature set and the split is not evidence of nondeterminism once the mechanism is deterministic and read from source. The test's own guard workedThis is not a silent breakage. The assertion that fires is the deliberate non-vacuity check, whose comment predicted precisely this:
Without it the transfer assertions would still pass and the test would have gone quietly inert. What the fix is notRestoring the FSM rejection would revert #7579 deliberately and re-open what its comment names: a peer ending the whole daemon with two greeting lines. The arm is upstream-faithful and security-motivated; it should stay. The fix belongs on the test — it needs a provoker that still produces a genuine session error under the current daemon, or an explicit decision that peer-triggerable session errors no longer exist (which is arguably what #7579 achieved, and would make this fixture unsatisfiable by construction rather than merely stale). That is a call for the owners of #7590 / #7579, and it is a master fix, not a change to this PR. ⚠ Caveat kept from before: nextest fail-fast truncated the run, so one failing test is a lower bound, not the failure set. |
|
Correction to my own blast-radius claim: it is every open PR, not the seven I listed. I earlier classified affected PRs by whether their head carries both A head that does not contain the test cannot fail it — unless the tested tree is not the head. It is not:
The cell set is also wider than the two I named. Both corrections make the case for the fix stronger, not weaker: the mechanism, the root cause and the fix in #7615 are unchanged — only my estimate of who is affected was too narrow. |
`## [Unreleased]` last covered the #7304-#7522 era. Measured against the 60 most recently merged pull requests, 44 were absent; of the most recent 45, 43 were absent. Nothing from #7574 onward was recorded at all. Each entry is derived from what the pull request actually landed - the merge commit and the body - not from its title. Three cases where those differ: * #7616 ships far more than the doc-alias correction its body describes: the `upstream_version` pin moves to 3.5.0 and `--version` starts naming `quic`, `sd-notify`, `vmsplice` and `send_zc`. * #7618 also adds the pull-request rustdoc-link job its body says was filed separately, which is what closes the master-only-gate recurrence. * #7602's squash carries the closed #7597 as its first commit, so the directory-obstacle half is recorded under #7602. #7587 is deliberately not recorded. Its merge commit is empty: the change had already landed as #7563, which the section already names. Entries extend the existing Keep a Changelog groups and the bold sub-groupings. Clusters that are one story carry one entry with several references: the FERROR_XFER routing and its two-phase drain (#7576, #7581), the connection-FSM close edge and the accept loop that outlives a session error (#7579, #7590), the three detaching daemon suites (#7578, #7588, #7592), the io_uring and SEND_ZC work (#7593, #7600, #7610), the citation retargets (#7601, #7603, #7604), and the accept-loop pin flake (#7615, #7620). Only `## [Unreleased]` is touched; every released section, including the 3.4.4 statements that were correct when written, is byte-identical.
The defect
All three tests in
tests/integration_daemon_filter_directives.rsstarted the daemon without--no-detach.RuntimeOptions::detachdefaults tocfg!(unix), sorun_daemonreachedbecome_daemon()in the accept loop and the parent of that fork - the test binary itself - exited 0 before any assertion ran.Proven by mutation on the base commit. With an unconditional
panic!inserted immediately after the daemon spawn:The tell was the runtime: 0.029s for three full TCP transfers through an in-process daemon.
What making them execute surfaced
The tests checked only that
run_clientreturnedOk. A daemon-refused push does not returnErr:generator.c:1669-1671reports the refusal asFERROR_XFERlog.c:337-338setsgot_xfer_erroron receiptcleanup.c:217-218lifts the exit status toRERR_PARTIAL(23,errcode.h:43)That status arrives on
ClientSummary::io_error_exit_code, not as an error, so the push's actual outcome was never asserted. It is 23 in all three scenarios, and nothing noticed.This matters because the assertions that did exist are one-sided.
!files.contains("drop1.log")is satisfied just as well by a transfer that achieved nothing at all. Each test now asserts exit 23 as the positive signal that the module directive actually fired.Two smaller corrections in the same pass:
collect_filescarries file contents alongside the names, so a kept file has to arrive intact rather than merely exist.clientserver.c:934-951,receiver.c:889,generator.c:1663.Mutation proofs
Each mutation reddens a distinct assertion, so neither is carrying the other.
Silencing the
FERROR_XFERframe incrates/transfer/src/receiver/transfer/candidates.rs- files are still excluded, so the on-disk assertions stay green and only the new assertion fires:Without the added exit-code assertion this regression would have been invisible.
Disabling the daemon filter check - the excluded files land and the file's own claim fires:
Unmutated:
3 tests run: 3 passed, 0 skipped.Guard
tools/ci/check_daemon_no_detach.shcovered onlycrates/daemon/src/tests. Root-level integration tests live outside the daemon crate and cannot reach its test-support helpers, so checks 1-3 were blind to them while the fork killed the test binary there just the same. A fourth check counts root tests callingrun_daemon(without--no-detach, with a shrink-only ceiling at the 2 files still to be migrated.Verified the guard fires rather than passing vacuously - temporarily lowering the ceiling to 1:
Those two are being migrated separately. This check overlaps the one in #7578, which fixes
integration_daemon_max_connections_cap.rs; whichever lands second should lower the ceiling again.Gates
cargo fmt --all -- --checkcleancargo clippy --workspace --all-targets --all-features --no-deps -- -D warningscleanbash tools/ci/check_daemon_no_detach.sh- no violationscargo xtask citations- exit 0, all citations resolve against the rsync 3.5.0 pin