← Back to Pull requests

fix(sources): keep idle TCP connections from starving busy connections #27116

Open
unknown opened this pull request with 210 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 10, 2026 16:45 UTC
Author

Summary

All TCP-based sources share one RequestLimiter per 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

sources:
  src:
    type: socket
    mode: tcp
    address: 127.0.0.1:7010
    decoding:
      codec: bytes
    framing:
      method: octet_counting
sinks:
  out:
    type: blackhole
    inputs: [src]

How did you test this PR?

New tests in src/sources/util/net/tcp/mod.rs cover 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?

  • Yes. Please add a changelog fragment based on our guidelines.

  • No. A maintainer will apply the no-changelog label to this PR.
  • Diff: 210 lines (+157 / -53) across 2 files Reviewer: JonSnow1807 Review duration: 26676m
    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
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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: 36.5% (MEDIUM) · Higher = larger blast radius
    36.5%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 19.4% · Safe to merge
    19.4%