fix(sources): keep idle TCP connections from starving busy connections #27116
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.36) × (1 − Review Confidence (0.47)).
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.02 · 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
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.320
Real PR Conversation Timeline
1 comments
"Review active on #27116"
general
weight: 0.35
JonSnow1807
Summary
All TCP-based sources share one
RequestLimiterper source. Each connection took a permit before reading and held it for up to 10 ms while waiting for data. So with many idle connections, a busy connection waited behind all of them for every batch.This implements option 1 from the issue: a connection whose last read found no more data waits until its socket is readable before it takes a permit. A small
ReadyFrames::is_inner_pending()tells whether frames may still be buffered, and if so the wait is skipped. Permits are still taken before decoding, so the memory bound is unchanged.With TLS, the wait peeks through OpenSSL, so a read that must write first (for example to answer a TLS 1.3 key update) waits for the socket to be writable.
References
Closes: #26492
Vector configuration
How did you test this PR?
New tests in
src/sources/util/net/tcp/mod.rscover starvation (plain and TLS), buffered frames, backpressure, and close, shutdown and reset while idle. The starvation tests fail on master. With one busy connection and 750 idle ones, throughput goes from 0.08–0.18 MiB/s on master to 31.0–31.8 MiB/s, which is about the same as with no idle connections.Does this PR include user facing changes?
no-changeloglabel to this PR.