Skip to content

fix(http2): avoid double-decrementing open streams on timeout#5074

Closed
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:h2-timeout-decrement
Closed

fix(http2): avoid double-decrementing open streams on timeout#5074
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:h2-timeout-decrement

Conversation

@trivikr

@trivikr trivikr commented Apr 20, 2026

Copy link
Copy Markdown
Member

This relates to...

Fixes: #5073

Rationale

client-h2.js was decrementing session[kOpenStreams] in both the timeout handler and the stream close handler.

Since the timeout path aborts and closes the stream, a single timed-out request could underflow the counter and skew H2 session ref/unref bookkeeping.

Changes

  • Remove the extra session[kOpenStreams] decrement from the HTTP/2 stream timeout handler.
  • Keep stream accounting single-sourced in the stream close handler.

Features

N/A

Bug Fixes

Prevent kOpenStreams from being decremented twice for a single timed-out HTTP/2 request.

Breaking Changes and Deprecations

N/A

Status

Assisted-by: openai:gpt-5.4
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.10%. Comparing base (f6c5dda) to head (fd2a716).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5074   +/-   ##
=======================================
  Coverage   93.10%   93.10%           
=======================================
  Files         110      110           
  Lines       35799    35793    -6     
=======================================
- Hits        33329    33325    -4     
+ Misses       2470     2468    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@trivikr

trivikr commented Apr 21, 2026

Copy link
Copy Markdown
Member Author

Merged in #5076

@trivikr trivikr closed this Apr 21, 2026
@trivikr trivikr deleted the h2-timeout-decrement branch April 21, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP/2 stream timeouts decrement session open-stream count twice

2 participants