Reserve sidecar ports below the ephemeral range #8587
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
ryanking13
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 wildcardlisten(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: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-autogateson linux-arm64 in the Build & Release run for #8546, andfetch/api-ts@on linux x64 (thewsserver). The same steps on a Linux executor give the same result: reserve127.27.155.200:Pand close it, listen on0.0.0.0:P, then binding127.27.155.200:Pfails 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 tolisten_port_bindings. The comments inwd_test.bzlandwpt_test.bzlthat mentioned a retry the supervisor never did are updated.