fix: preserve h2 queue on out-of-order completion#5410
Open
mcollina wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5410 +/- ##
==========================================
- Coverage 93.24% 93.23% -0.01%
==========================================
Files 110 110
Lines 36825 36842 +17
==========================================
+ Hits 34336 34351 +15
- Misses 2489 2491 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
764c392 to
565bbd7
Compare
Signed-off-by: Matteo Collina <hello@matteocollina.com>
565bbd7 to
04b4b68
Compare
metcoder95
approved these changes
Jun 11, 2026
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.
Fixes: #5404
HTTP/2 streams can complete out of order. The H2 completion path was advancing
kRunningIdxand clearingkQueue[kRunningIdx], which assumes in-order completion. When a later stream completed first, this could clear the wrong request slot and leave completed/running entries misclassified. Destroy/error paths could then lose the still-running request or encounternullqueue entries.This changes H2 request finalization to remove the actual completed request from the running queue section, preserving other running requests. It also skips stale
nullentries defensively in destroy/error cleanup loops.Tested with:
node --test test/issue-5404.jsnode --test test/issue-5404.js test/http2-resume-null-request.js test/http2-goaway-retry-body.js test/http2-invalid-session.jsnode --test test/http2-dispatcher.jsnode --test test/issue-5404.js test/http2-pipelining-default.jsnpm run test:h2:corenpm run lint