Skip to content

fix(h2): unref a session detached by GOAWAY with no open streams - #5960

Merged
mcollina merged 1 commit into
nodejs:mainfrom
kjsik11:fix/h2-unref-goaway-session-without-streams
Oct 5, 2026
Merged

mcollina merged 1 commit into
nodejs:mainfrom
kjsik11:fix/h2-unref-goaway-session-without-streams

Conversation

@kjsik11

@kjsik11 kjsik11 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

This relates to...

Regression from #5839

resumeH2 (#5839): keeps the session ref'd while requests are queued.
onHttp2SessionGoAway (this PR): unrefs the session detached by GOAWAY when it has no open streams.

Rationale

When the peer advertises SETTINGS_MAX_CONCURRENT_STREAMS = 0, requests are queued without a stream.
After the peer sends GOAWAY, the session is detached but never unref'd, so it keeps the process alive.

Changes

  • lib/dispatcher/client-h2.js: onHttp2SessionGoAway() unrefs the detached session if it has no open streams
  • test/http2-max-concurrent-streams-zero-unref.js: the peer sends GOAWAY while a request is queued. The child must exit after the request completes

Bug Fixes

  • A session detached by GOAWAY with no open streams is now unref'd

Tests (Node 24.20.0)

  • npm run lint
  • npm run test:h2:core (122/122)
  • npx borp -p "test/http2-max-concurrent-streams-zero-unref.js" (3/3,main 2/3)

Assisted-by: Claude Code

Status

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina
mcollina merged commit 810f11c into nodejs:main Oct 5, 2026
34 of 38 checks passed
@kjsik11
kjsik11 deleted the fix/h2-unref-goaway-session-without-streams branch October 5, 2026 07:35
@github-actions github-actions Bot mentioned this pull request Oct 14, 2026
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.

2 participants