Skip to content

fix(client-h2): avoid double-decrement of open streams on timeout#5071

Draft
deepview-autofix wants to merge 1 commit intonodejs:mainfrom
deepview-autofix:deepview/0d31dc11f4
Draft

fix(client-h2): avoid double-decrement of open streams on timeout#5071
deepview-autofix wants to merge 1 commit intonodejs:mainfrom
deepview-autofix:deepview/0d31dc11f4

Conversation

@deepview-autofix
Copy link
Copy Markdown
Contributor

The 'timeout' handler was manually decrementing session[kOpenStreams] before calling abort(). abort() closes the stream, which triggers the 'close' handler that also decrements the counter, causing the counter to go negative and leading to session.unref() being called while streams are still active.

Let the 'close' handler own the decrement, matching the pattern used by the other stream lifecycle events.

The 'timeout' handler was manually decrementing session[kOpenStreams]
before calling abort(). abort() closes the stream, which triggers the
'close' handler that also decrements the counter, causing the counter
to go negative and leading to session.unref() being called while
streams are still active.

Let the 'close' handler own the decrement, matching the pattern used
by the other stream lifecycle events.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: DeepView Autofix <276251120+deepview-autofix@users.noreply.github.com>
Co-Authored-By: Nikita Skovoroda <chalkerx@gmail.com>
Signed-off-by: Nikita Skovoroda <chalkerx@gmail.com>
@deepview-autofix deepview-autofix marked this pull request as draft April 19, 2026 19:51
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.09%. Comparing base (2a07f01) to head (ee60b11).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5071      +/-   ##
==========================================
- Coverage   93.09%   93.09%   -0.01%     
==========================================
  Files         110      110              
  Lines       35788    35782       -6     
==========================================
- Hits        33318    33312       -6     
  Misses       2470     2470              

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

@mcollina
Copy link
Copy Markdown
Member

why is this a draft?

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.

3 participants