Skip to content

fix(tokio): make the dead-address test fixture fail fast on macOS - #5335

Merged
kixelated merged 2 commits into
mainfrom
fix/macos-dial-any-refused
Oct 13, 2026
Merged

kixelated merged 2 commits into
mainfrom
fix/macos-dial-any-refused

Conversation

@kixelated

@kixelated kixelated commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The nightly Tests (rs macos-test) job has failed every night since it was added: connection::tests::dial_any_reports_failure_when_nothing_answers times 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_addresses took 10s (two 5s per-attempt bounds) and dialing_never_logs_the_credential took 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() with dead(): 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 use dead(). 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 the macos job in platform.yml (run). All three tests that use the fixture passed in about 50ms each, down from 30s, 10s, and 30s in the nightly.

Impact

  • None. Test-only change; no public API or wire impact.

Alternatives

  • Bind an ephemeral port and drop it, so nothing is bound and every OS refuses. Simpler, but the port is free for another listener or an ephemeral self-connect to take mid-test, which the old fixture deliberately avoided.
  • Raise the test timeout. Rejected: it would hide the black-hole and keep these tests 35s slow on macOS.

Follow-ups

None.

(Written by Opus 5.5)

🤖 Generated with Claude Code

@kixelated
kixelated force-pushed the fix/macos-dial-any-refused branch from c922649 to f1ef6f2 Compare October 11, 2026 23:18
@kixelated
kixelated marked this pull request as ready for review October 11, 2026 23:18
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T23:20:15.682481Z f1ef6f2 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 99afb693-0584-4790-abe0-51b1ad5855c6
📥 Commits

Reviewing files that changed from the base of the PR and between d68bd0a and d854d8d.

📒 Files selected for processing (1)
  • rs/moq-tokio/src/connection.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Merging: test-only fixture fix, CI green on all platforms, Codex review clean (thumbs up). No decisions outstanding; queued ahead of #5350, #5352, and #5351, which touch the same files.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 13, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 13, 2026
@kixelated
kixelated force-pushed the fix/macos-dial-any-refused branch from f1ef6f2 to b8a2cac Compare October 13, 2026 01:22

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

kixelated and others added 2 commits October 12, 2026 20:11
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>
@kixelated
kixelated force-pushed the fix/macos-dial-any-refused branch from b8a2cac to d854d8d Compare October 13, 2026 03:20
@kixelated

Copy link
Copy Markdown
Collaborator Author

Update before merging: #5237 had added a_refused_tcp_dial_keeps_retrying on the old refused() fixture, so the first queue attempt would not have compiled. That test checks refusal itself, so it now binds an ephemeral port and releases it (an unbound port refuses on every OS) instead of using dead(). Rebased on main after #5381 fixed the tail.rs formatting that failed Check on every branch. The OpenAI review of b8a2cac had no findings; just check passes.

(Written by Claude Opus 5.5)

@kixelated
kixelated enabled auto-merge October 13, 2026 03:20
@kixelated
kixelated added this pull request to the merge queue Oct 13, 2026
Merged via the queue into main with commit 175cd06 Oct 13, 2026
6 checks passed
@kixelated
kixelated deleted the fix/macos-dial-any-refused branch October 13, 2026 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant