Repository navigation
fix(h2): replay requests whose HEADERS raced a GOAWAY - #6065
Merged
mcollina merged 2 commits intoOct 24, 2026
Merged
Conversation
A stream opened before the client processes a GOAWAY but flushed after it is refused by nghttp2 and surfaces as a frameError on the HEADERS frame. When the GOAWAY's lastStreamID covers the stream (2^31-1, the graceful shutdown notice hyper, Go and nghttp2 send), the request stays attached to the session and the frameError rejected it, although the peer never saw it. Requeue such requests when the body is replayable, within the GOAWAY replay budget. Refs: nodejs#6064 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Mohamed Elsharnouby <mohamed@radar.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6065 +/- ##
==========================================
+ Coverage 91.56% 91.61% +0.04%
==========================================
Files 113 113
Lines 43938 44044 +106
==========================================
+ Hits 40234 40349 +115
+ Misses 3704 3695 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: Matteo Collina <hello@matteocollina.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This relates to...
Refs #6064
Rationale
When a server starts a graceful shutdown with
GOAWAY(NO_ERROR, 2^31-1), a request dispatched just before the client processes the GOAWAY can have its stream opened but its HEADERS not flushed yet. nghttp2 then refuses to send it (no new streams after a received GOAWAY) and emitsframeError(type HEADERS) on the stream. BecauselastStreamIDcovers the stream,onHttp2SessionGoAwayleaves the request attached to the session, andonFrameErrorrejects it withHTTP/2: "frameError" received - type 1, code 2, even though the server never saw it.Streams that were sent but fall above the final GOAWAY's
lastStreamID(hyper/Go sendGOAWAY(2^31-1)+ PING, thenGOAWAY(last)) are already refused by nghttp2 withREFUSED_STREAMand retried by the existing refused-stream path.The stalls in the issue's reproduction come from the
node:http2server: nghttp2 ignores every new stream once it has sent a GOAWAY, whateverlastStreamIDit advertised, and never follows up with a final GOAWAY. The client receives no signal for those streams, so they can only time out.Changes
Features
N/A
Bug Fixes
client-h2: on aframeErrorfor a HEADERS frame after the session received GOAWAY, requeue the request on a new connection if no response started and the body is replayable. Uses the existing GOAWAY replay budget.retryRefusedStreamintorequeueStreamRequest.test/http2-graceful-goaway.js: 400 requests with 4 in flight against a server that retires each session every 8 streams, withGOAWAY(0)and with a gracefulGOAWAY(2^31-1)+ PING +GOAWAY(last). The graceful case failed withframeErrorbefore this change.Breaking Changes and Deprecations
N/A
Status
🤖 Generated with Claude Code