Repository navigation
fix(tokio): make the dead-address test fixture fail fast on macOS - #5335
Conversation
c922649 to
f1ef6f2
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
f1ef6f2 to
b8a2cac
Compare
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed b8a2cac, including the full current PR patch and surrounding connection tests/retry handling. No actionable bugs found. The test-only direction is sound: accepting and dropping connections avoids a platform-dependent black hole while retaining the port for the dial-walk fixtures; the refusal-specific test remains separate.
Verification limits: GitHub source inspection only; I did not execute tests or validate current-head CI. The refusal-specific test releases its ephemeral port before dialing, so unlike the dead-address fixture it cannot guarantee that another process will not reuse that port.
A SYN to a socket that is bound but not listening is refused on Linux but silently dropped on macOS, so each dial ran to its attempt bound or the 30s connect timeout. Listen and hang up on every connection instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#5237 added a_refused_tcp_dial_keeps_retrying on the old refused() fixture, which this branch removes. Refusal is what that test checks, so it binds an ephemeral port and releases it rather than using dead(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b8a2cac to
d854d8d
Compare
|
Update before merging: #5237 had added (Written by Claude Opus 5.5) |
Problem
The nightly
Tests (rs macos-test)job has failed every night since it was added:connection::tests::dial_any_reports_failure_when_nothing_answerstimes out after 30s.The
refused()fixture bound a TCP socket without listening, which refuses on Linux. macOS silently drops a SYN to a bound-but-not-listening socket instead of sending RST, so the "dead" addresses black-holed. The nightly timings show it:dial_any_walks_past_the_dead_addressestook 10s (two 5s per-attempt bounds) anddialing_never_logs_the_credentialtook 30s (the default connect timeout). The failing test's walk is 5s for the first address plus 30s for the last, past its 30s guard.The product is fine: every attempt is bounded by the per-attempt bound or the connect timeout, so the dial never hangs forever. Only the fixture is wrong.
Approach
Replace
refused()withdead(): a loopback listener that accepts and immediately drops every connection, so the qmux handshake hits EOF and the dial fails fast on every OS. Listening also keeps the port reserved, same as before.a_refused_tcp_dial_keeps_retrying(added by #5237) checks refusal itself, so it can't usedead(). It binds an ephemeral port and releases it, since a port nothing is bound to refuses on every OS.Verified on macOS with a temporary commit (since dropped) that added
just rs test -p moq-tokio -E 'test(/^connection::tests::dial/)'to themacosjob inplatform.yml(run). All three tests that use the fixture passed in about 50ms each, down from 30s, 10s, and 30s in the nightly.Impact
Alternatives
Follow-ups
None.
(Written by Opus 5.5)
🤖 Generated with Claude Code