Skip to content

http2: emit error on canceled streams when aborted event is not emitted#62923

Open
mcollina wants to merge 1 commit intonodejs:mainfrom
mcollina:fix-http2-cancel-stream-error
Open

http2: emit error on canceled streams when aborted event is not emitted#62923
mcollina wants to merge 1 commit intonodejs:mainfrom
mcollina:fix-http2-cancel-stream-error

Conversation

@mcollina
Copy link
Copy Markdown
Member

When a client HTTP/2 stream's writable side is already ended (e.g. GET requests), receiving RST code 8 (NGHTTP2_CANCEL) emitted neither the aborted nor the error event, causing the stream to close silently.

The fix only skips error generation for NGHTTP2_CANCEL when the aborted event was actually emitted.

Fixes: #56627

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/net

@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 Apr 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

❌ Patch coverage is 82.60870% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.66%. Comparing base (58a8e1d) to head (f3dd59d).
⚠️ Report is 98 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/http2/core.js 82.60% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62923      +/-   ##
==========================================
- Coverage   89.69%   89.66%   -0.04%     
==========================================
  Files         706      706              
  Lines      218222   219419    +1197     
  Branches    41768    42077     +309     
==========================================
+ Hits       195731   196735    +1004     
- Misses      14411    14602     +191     
- Partials     8080     8082       +2     
Files with missing lines Coverage Δ
lib/internal/http2/core.js 95.16% <82.60%> (-0.09%) ⬇️

... and 90 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.

@mcollina mcollina force-pushed the fix-http2-cancel-stream-error branch from 31d3521 to abff173 Compare April 24, 2026 21:58
When a client HTTP/2 stream's writable side is already ended (e.g.
GET requests), receiving RST code 8 (NGHTTP2_CANCEL) emitted neither
the 'aborted' nor the 'error' event, causing the stream to close
silently. This happened because the 'aborted' event is only emitted
when the writable side is still open, but the NGHTTP2_CANCEL code was
unconditionally excluded from error generation assuming the 'aborted'
event would cover it.

Fix by only skipping error generation for NGHTTP2_CANCEL when the
'aborted' event was actually emitted.

Fixes: nodejs#56627
@mcollina mcollina force-pushed the fix-http2-cancel-stream-error branch from abff173 to f3dd59d Compare April 25, 2026 07:23
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: confusion with how aborted ClientHttp2Stream is reported

2 participants