← Back to Pull requests

Reserve sidecar ports below the ephemeral range #8587

Closed
unknown closed this pull request without merging on Nov 18, 2026 05:58 UTC
View on GitHub
unknown unknown commented on Nov 18, 2026 05:30 UTC
Author

In preallocate mode the sidecar supervisor binds port 0, notes the port, closes the socket and starts wptserve, which binds the port again about 1.5s later. A port from listen(0) is an ephemeral one, so in that gap another process's wildcard listen(0) can get the same port. On Linux a wildcard listener on a port blocks binding that port on any loopback address. wptserve then fails to start that server:

[http-public on port 41575] CRITICAL - start_http_server: Caught exception from wptserve.WebTestHttpd: [Errno 98] Address already in use

The readiness probe still connects, to the other process's listener, so the test runs against a half-started wptserve and fails. This hit //src/wpt:fetch/api@all-autogates on linux-arm64 in the Build & Release run for #8546, and fetch/api-ts@ on linux x64 (the ws server). The same steps on a Linux executor give the same result: reserve 127.27.155.200:P and close it, listen on 0.0.0.0:P, then binding 127.27.155.200:P fails with Errno 98 while connecting to it succeeds.

In this patch the supervisor picks each reserved port at random in 10000-32767. That is below the default ephemeral ranges of Linux (32768-60999), macOS and Windows (49152-65535), so the kernel doesn't hand these ports to another process's listen(0). If a port can't be bound, the supervisor tries another. This also applies to listen_port_bindings. The comments in wd_test.bzl and wpt_test.bzl that mentioned a retry the supervisor never did are updated.

Diff: 188 lines (+141 / -47) across 2 files Reviewer: ryanking13 Review duration: 27m
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.36) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 188 lines diff across 2 files
0.36
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
56%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.314
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8587"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 56.8% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 35.8% (MEDIUM) · Higher = larger blast radius
35.8%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 56.8% · Lower = rushed or shallow review
56.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.5% · Safe to merge
15.5%