Repository navigation
test(daemon): stop the max-connections cap test passing without running - #7578
Merged
Merged
Conversation
`daemon_caps_concurrent_module_connections_at_max_connections` never ran
a single assertion. It spawns `run_daemon` on a thread without
`--no-detach`, and `RuntimeOptions::detach` defaults to `cfg!(unix)`, so
the accept loop reaches `become_daemon()` (accept_loop.rs:287). That
forks, and the parent of the fork is the test binary itself, which exits
0 (`platform::daemonize::become_daemon`). libtest and nextest record the
process's clean exit as a pass.
Proven by mutation, not by reading:
* Removing the cap from production entirely - `MaxConnections::Limited`
returning an unlimited guard in `try_acquire_connection` - left the
test at `1 test run: 1 passed` in 0.033s.
* An unconditional `panic!` in the test body also reported
`1 test run: 1 passed`, in 0.018s.
0.02s is itself the tell: the body contains a 250ms sleep it never
reached. Each run also leaked a real background daemon that outlived the
test process.
Turning the test on exposed three further defects, all masked by the
detach:
* The client fixture sent a bare `@RSYNCD: 32.0`. The digest name list
is mandatory for protocol > 31 (clientserver.c:228-238), so all three
probes were refused at the greeting and the module request was never
reached. Now sends `@RSYNCD: 32.0 md5 md4`.
* `cap_line.starts_with("oc-rsync warning:")` could never hold: every
daemon log line carries upstream's `YYYY/MM/DD HH:MM:SS [pid] `
prefix (log.c:135). The level check now runs against the message with
that prefix stripped, and the prefix shape itself is asserted rather
than assumed.
* The "skip when the daemon never bound" guard fired on any outcome
where every client failed, including clients that connected and then
hit a broken daemon - it swallowed exactly the failures the test
exists to catch. `ClientError` now separates a connect-phase failure
from an exchange failure, and only the former can skip.
The fixed test reddens on the same mutation:
assertion `left == right` failed: exactly 2 clients should be
admitted, got 3; refused=[]
left: 3
right: 2
and on a level mutation of the DMC-5 warning:
cap line must be warning-level (DMC-5): ... oc-rsync error:
max-connections cap reached: which=capped peer=localhost
(127.0.0.1) cap=2 current=2 ...
The 250ms sleep is replaced by a `Barrier`: no client returns - and so
no socket closes and no slot is handed back - until all three have been
classified. The contended probe is now deterministic instead of merely
likely. The daemon join is a plain `join()` for the same reason.
`tools/ci/check_daemon_no_detach.sh` already guards this defect class,
but its scan is scoped to `crates/daemon/src/tests/chunks`, so the
root-level integration tests were invisible to it. It now also counts
files under `tests/` that call `run_daemon()` without ever naming
`--no-detach`, against a shrink-only ceiling. Two remain -
`integration_daemon_server.rs` and `integration_daemon_filter_directives.rs`
- and they are vacuous on Unix for the same reason; they are left for
separate slices because their assertions need triaging once they start
executing.
No production code is changed: the cap, its wire payload and its log line
were all correct once the test could see them.
This was referenced Sep 1, 2026
oferchen
added a commit
that referenced
this pull request
Sep 2, 2026
`## [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.
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.
daemon_caps_concurrent_module_connections_at_max_connectionsnever rana single assertion. It spawns
run_daemonon a thread without--no-detach, andRuntimeOptions::detachdefaults tocfg!(unix), sothe accept loop reaches
become_daemon()(accept_loop.rs:287). Thatforks, and the parent of the fork is the test binary itself, which exits
0 (
platform::daemonize::become_daemon). libtest and nextest record theprocess's clean exit as a pass.
Proven by mutation, not by reading:
MaxConnections::Limitedreturning an unlimited guard in
try_acquire_connection- left thetest at
1 test run: 1 passedin 0.033s.panic!in the test body also reported1 test run: 1 passed, in 0.018s.0.02s is itself the tell: the body contains a 250ms sleep it never
reached. Each run also leaked a real background daemon that outlived the
test process.
Turning the test on exposed three further defects, all masked by the
detach:
@RSYNCD: 32.0. The digest name listis mandatory for protocol > 31 (clientserver.c:228-238), so all three
probes were refused at the greeting and the module request was never
reached. Now sends
@RSYNCD: 32.0 md5 md4.cap_line.starts_with("oc-rsync warning:")could never hold: everydaemon log line carries upstream's
YYYY/MM/DD HH:MM:SS [pid]prefix (log.c:135). The level check now runs against the message with
that prefix stripped, and the prefix shape itself is asserted rather
than assumed.
where every client failed, including clients that connected and then
hit a broken daemon - it swallowed exactly the failures the test
exists to catch.
ClientErrornow separates a connect-phase failurefrom an exchange failure, and only the former can skip.
The fixed test reddens on the same mutation:
and on a level mutation of the DMC-5 warning:
The 250ms sleep is replaced by a
Barrier: no client returns - and sono socket closes and no slot is handed back - until all three have been
classified. The contended probe is now deterministic instead of merely
likely. The daemon join is a plain
join()for the same reason.tools/ci/check_daemon_no_detach.shalready guards this defect class,but its scan is scoped to
crates/daemon/src/tests/chunks, so theroot-level integration tests were invisible to it. It now also counts
files under
tests/that callrun_daemon()without ever naming--no-detach, against a shrink-only ceiling. Two remain -integration_daemon_server.rsandintegration_daemon_filter_directives.rsseparate slices because their assertions need triaging once they start
executing.
No production code is changed: the cap, its wire payload and its log line
were all correct once the test could see them.