Skip to content

http2: emit session close before stream close#63414

Open
mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:fix-http2-session-close-order-63412
Open

http2: emit session close before stream close#63414
mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:fix-http2-session-close-order-63412

Conversation

@mcollina
Copy link
Copy Markdown
Member

@mcollina mcollina commented May 18, 2026

Fixes: #63412

This changes the HTTP/2 session shutdown path so that when the transport has
already been closed, the client session 'close' event is queued before stream
close callbacks are scheduled.

That gives clients a race-free chance to invalidate cached
ClientHttp2Session instances before stream 'close' handlers try to reuse
that session and synchronously hit ERR_HTTP2_INVALID_SESSION.

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/net

PR-URL: nodejs#63414
Signed-off-by: Matteo Collina <hello@matteocollina.com>
@nodejs-github-bot nodejs-github-bot added http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run. labels May 18, 2026
@mcollina mcollina force-pushed the fix-http2-session-close-order-63412 branch from 94d6b49 to 0984bca Compare May 18, 2026 17:33
@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

❌ Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.06%. Comparing base (debe2ed) to head (0984bca).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/http2/core.js 96.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63414      +/-   ##
==========================================
+ Coverage   90.05%   90.06%   +0.01%     
==========================================
  Files         714      714              
  Lines      225742   225765      +23     
  Branches    42727    42723       -4     
==========================================
+ Hits       203285   203335      +50     
+ Misses      14234    14230       -4     
+ Partials     8223     8200      -23     
Files with missing lines Coverage Δ
lib/internal/http2/core.js 95.19% <96.66%> (+<0.01%) ⬆️

... and 51 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

http2: ClientHttp2Session can be invalid before close event is emitted

2 participants