← Back to Pull requests

UCP/WIREUP: Fix pending count when wireup send fails the EP #12394

Closed
unknown closed this pull request without merging on Nov 24, 2026 20:19 UTC
View on GitHub
unknown unknown commented on Nov 19, 2026 12:54 UTC
Author

What?


Fix Assertion 'wireup_ep->pending_count == 0' failed in ucp_wireup_ep_pending_purge(), and a use-after-free of the wireup EP, when sending a pending wireup message fails the UCP EP.

Why?


A wireup message queued on a wireup EP is wrapped in a proxy request and added to the pending queue of the UCT EP. wireup_ep->pending_count counts these requests, so that the purge knows to purge the UCT queue.

UCT removes the proxy request from its queue before calling ucp_wireup_ep_progress_pending(), but the counter was decremented only after the send. TCP reports a send error by calling the iface error handler from inside uct_ep_am_bcopy(). The UCP EP is then failed and its lanes are discarded. The purge does not find the request on the UCT queue, so the count stays 1 and the assertion fails. Without assertions, the wireup EP is destroyed during the send, and the decrement then writes to freed memory (confirmed with valgrind).

Seen in CI on tcp/test_ucp_wireup_errh_peer.force_close_simultaneous_connect_winner/0: in a simultaneous connect, TCP adopts the socket of the force-closed EP, and the pending wireup request fails with a broken pipe.

How?


  • ucp_wireup_ep_progress_pending(): decrement pending_count before sending, and increment it back if the request goes back to the pending queue.

  • New gtest test_ucp_wireup_errh_peer.pending_wireup_msg_send_error: on tcp, fail the send of the pending wireup request from inside uct_ep_am_bcopy(), as tcp does. Without the fix it hits the assertion on all tcp variants.
  • Diff: 196 lines (+147 / -49) across 2 files Reviewer: tvegas1 Review duration: 7644m
    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 · 196 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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
    Diff Size diff_size
    0.316
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #12394"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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.1% (MEDIUM) · Higher = larger blast radius
    36.1%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 14.2% · Safe to merge
    14.2%
    Repository