Fix `bm_fastapi` benchmark failing with `httpx.PoolTimeout` under load #509
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 210 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.320
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #509"
general
weight: 0.35
savannahostrowski
Fixes #508
Problem
The
fastapibenchmark (bm_fastapi) intermittently fails withhttpx.PoolTimeoutwhen the machine running the benchmark is under heavy load.The benchmark fires
CONCURRENCY = 150concurrent requests, but thehttpx.AsyncClientuses httpx's defaultmax_connections = 100. The 50 requeststhat exceed the pool size wait in the pool's queue for a connection to free up.
httpx's default pool timeout is 5 seconds, so when the in-flight requests take
longer than 5 seconds (which is exactly what happens under load), those 50 queued
requests exceed the pool timeout and the benchmark dies:
Fix
Size the connection pool to the benchmark's concurrency so that no request ever
queues:
With the pool sized to
CONCURRENCY, all 150 requests acquire a connectionimmediately, so the pool timeout can never be hit regardless of server latency.
This builds on the trust_env=False change from #505 and keeps it
Testing
Reproduced deterministically by serving the endpoint with an artificial ~6s
per-request delay and firing 150 concurrent requests:
httpx.PoolTimeoutafter ~5.1smax_connections=150→ completes successfully (~7.1s)No behavior change in the common case: the benchmark's concurrency is a fixed
constant, so the pool is simply sized to match it.