test(server): give each connect of the listener queue test its own bound #9234
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.48) × (1 − Review Confidence (0.49)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 519 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 70% · 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.374
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #9234"
general
weight: 0.35
claude[bot]
Description
Problem
What changes for a reader of the test results:
server::tests::the_http_listener_queues_what_its_host_allowsno longer fails on a slow test host. It failed in runs of the gateway's unit tests on changes that touch no gateway file, witha connection past 128 was not queued, and passed on the same tree elsewhere.The test binds the listeners, accepts nothing and opens
min(somaxconn, 256)loopback connections one after another under one bound of three seconds for the whole loop, while the same binary runs about five thousand other tests. A connection the listener does queue can lose its first packet on a loaded host; the kernel sends it again after one second and after three. A few such connects, or a host that is only slow, carry the loop past its bound although every connection is queued, and the one message cannot tell a slow host from a short queue.Solution
Each connect gets its own bound of five seconds, which holds both resends; the loop has none. A slow host makes the test slow, not red. A connection past a short queue never completes while nothing accepts, so the test still fails there, and names it: a listener that asks for 128 queues 129, and the test stops with
connection 130 of 256 was not queued within 5s. A connect that returns an error fails withconnection N of M failed: <error>. The test asserts as much as before: every one ofmin(somaxconn, 256)connections is queued.Ready check
Changes
model_gateway/src/server.rs:the_http_listener_queues_what_its_host_allowsbounds each connect on its own and tells a bound that ran out from a connect that failed.Test Plan
connection 130 of 256 was not queued within 5s; with the line it guards in place: 1 passed.a connection past 128 was not queued; with the change it passes 20 of 20. A dropped first packet was not run: that five seconds hold its two resends is read from the kernel's retry times.cargo fmt -p smg -- --check,cargo clippy -p smg --all-targets -- -D warningsandRUSTDOCFLAGS='-D warnings' cargo doc --locked -p smg --no-deps: clean.cargo test -p smg --test startup_tests: 46 passed, 0 failed.Release note
The unit test of the HTTP listener's accept queue bounds each connect on its own (five seconds) instead of the whole loop (three seconds): a slow or loaded test host no longer fails it, and a listener with a short queue still fails it, at the first connection that is not queued. Test code only: nothing the gateway does changes.
Numbers
| metric | before | after | setup |
|---|---|---|---|
| starts that pass, of 20, with every connect call delayed by 15 ms | 0 | 20 | 256 connects take about 3.9 s and every one is queued; before:
a connection past 128 was not queuedat the 3 s bound; after: the test takes 4.0 s to 6.3 s || starts that pass, of 20, the test alone | 20 | 20 | one test executable a side, the two sides taken in turn, ten starts a turn |
| the test's own time alone, median of 20 (min to max) | 0.08 s (0.06 to 0.15) | 0.07 s (0.06 to 0.09) | same starts, the time the test harness prints |
| the test on a listener that asks for 128 | not run | fails after 5.34 s:
connection 130 of 256 was not queued within 5s| the listener's queue length reversed to 128 on a host that allows 4096 |