← Back to Pull requests

[v26.x] http2: do not reset stream before END_STREAM is sent #66672

Closed
unknown closed this pull request without merging on Nov 13, 2026 10:27 UTC
View on GitHub
unknown unknown commented on Oct 12, 2026 04:28 UTC
Author

When a compat API response finishes and the request had no body,
kMaybeDestroy() takes the graceful-close path and sends RST_STREAM(NO_ERROR)
right away. If the connection flow-control window is exhausted at that
point, the empty END_STREAM DATA frame is still queued, so the reset goes
out first and END_STREAM is dropped. The client gets the full body but no
END_STREAM, so it treats the response as incomplete.

This skips the graceful close when the request already ended with its
HEADERS frame, since there is no request body to stop.

This targets v26.x-staging because main is not affected: the trailer
changes in #64265 avoid this path, but the v26 backport (#64663) left
them out. I could also reproduce it on v22.16.0, and the issue reports
v24.x too.

Testing:

  • Repro script from the issue: RST_STREAM(code=0) before the fix,

  • DATA(0B, END_STREAM) after.
  • Added test-http2-compat-serverresponse-end-stream-flow-control.js. It

  • checks that /small gets END_STREAM before any reset, and that the server
    stream still closes on its own.
  • python tools/test.py "parallel/test-http2-*": 283 passed (Windows x64).
  • Fixes: https://github.com/nodejs/node/issues/66525
    Refs: https://github.com/nodejs/node/pull/64265
    Refs: https://github.com/nodejs/node/pull/64663

    Diff: 162 lines (+121 / -41) across 2 files Reviewer: efekrskl Review duration: 46438m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.35) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.35 · 162 lines diff across 2 files
    0.35
    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%
    56%
    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.305
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #66672"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 34.9% (LOW) · Higher = larger blast radius
    34.9%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 15.1% · Safe to merge
    15.1%
    Repository