← Back to Pull requests

fix(native): Release pending HTTP exchange buffers on close #28823

Open
unknown opened this pull request with 442 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 23, 2026 14:49 UTC
Author

Description


<!---Describe your changes in detail-->
Use weak references in Prestissimo exchange response callbacks so pending requests and queued responses can release the exchange source and its query memory pool. close() releases buffered response data that the driver has yet to claim. Producer DELETE retries continue with independent retry state.

Motivation and Context


<!---Why is this change required? What problem does it solve?-->
<!---If it fixes an open issue, please link to the issue here.-->
After a query closes its exchange, pending HTTP responses and producer cleanup retries can keep the exchange source and its memory pool alive. This PR addresses the Prestissimo side of the shutdown issue. Velox #20083 discussion

Impact


<!---Describe any public API or user-facing feature change or any performance impact-->

Test Plan


<!---Please fill in how you tested your change-->
  • Exercise shutdown with an HTTP request in flight and with a completed response queued on the driver executor.

  • Verify that the source and query pools can be released before pending callbacks finish, including when immediate transfer has already allocated response buffers.

  • Force the first producer DELETE to fail and verify that the retry succeeds after the source is released.

  • Run the Prestissimo exchange, HTTP, and common test suites.
  • Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.

  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.

  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.

  • If release notes are required, they follow the release notes guidelines.

  • Adequate tests were added if applicable.

  • CI passed.

  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).
  • Release Notes


    Please follow release notes guidelines and fill in the release notes below.

    == RELEASE NOTES ==
    
    General Changes
    * Fix query memory retention from pending HTTP exchange responses during shutdown.
    
    

    Summary by Sourcery

    Ensure native exchange shutdown releases pending HTTP response resources without retaining query state.

    Bug Fixes:

  • Release buffered HTTP exchange response data and query memory when an exchange source closes, including responses still in flight or queued for driver processing.

  • Prevent pending HTTP callbacks from retaining exchange sources and query memory pools after shutdown.

  • Preserve independent retry handling for producer result cleanup after the exchange source is released.
  • Enhancements:

  • Refactor HTTP response body buffering to support safe ownership transfer and concurrent cleanup during exchange shutdown.
  • Tests:

  • Add shutdown coverage for in-flight and queued responses, immediate buffer transfer, memory-pool release, and producer cleanup retries.
  • Diff: 442 lines (+331 / -111) across 5 files Reviewer: mbasmanova Review duration: 10636m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.45) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 442 lines diff across 5 files
    0.45
    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
    Diff Size diff_size
    0.365
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #28823"
    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: 45.3% (MEDIUM) · Higher = larger blast radius
    45.3%
    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: 24.1% · Safe to merge
    24.1%