Skip to content

test(sandbox): bind ephemeral port in accepted loopback stream test - #3872

Merged
krishicks merged 1 commit into
mainfrom
fix-loopback-broker-test-flake/krishicks
Sep 29, 2026
Merged

krishicks merged 1 commit into
mainfrom
fix-loopback-broker-test-flake/krishicks

Conversation

@krishicks

Copy link
Copy Markdown
Collaborator

Summary

Fix a flaky openshell-sandbox unit test, network_broker::tests::accepted_loopback_stream_is_registered_for_notified_operations, which failed in CI with listener ready: RecvError.

Related Issue

No issue required: this is an obvious localized fix for a race in the test's port selection.

Changes

  • The test reserved a loopback port, released it, and bound it again inside the workload. Another nextest process could take the port in between. The workload's bind then failed with EADDRINUSE, which dropped the ready sender and showed up only as a RecvError.
  • The workload now binds 127.0.0.1:0 and sends the assigned address over the ready channel. The broker's bind/listen path supports port 0, and getsockname is not intercepted.
  • If the listener never becomes ready, the test joins the workload and panics with its actual I/O error.

Testing

  • mise run pre-commit passes
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

The test is Linux-only (seccomp) and was not run locally on macOS. CI covers it.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)

The test reserved a loopback port, released it, and rebound it inside the
workload. A concurrent nextest process could claim the port in between,
failing the bind and surfacing only as a RecvError on the ready channel.
Bind port 0 in the workload and send the assigned address instead, and
report the workload error when the listener never becomes ready.

Signed-off-by: Kris Hicks <khicks@nvidia.com>
@krishicks
krishicks enabled auto-merge September 29, 2026 16:43
@krishicks
krishicks added this pull request to the merge queue Sep 29, 2026
Merged via the queue into main with commit 2ad77ad Sep 29, 2026
73 checks passed
@krishicks
krishicks deleted the fix-loopback-broker-test-flake/krishicks branch September 29, 2026 16:57
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.

2 participants