Skip to content

http2: clear the session timeout before marking it destroyed - #66886

Open
Huang-404-Q wants to merge 1 commit into
nodejs:mainfrom
Huang-404-Q:fix/http2-session-timeout-on-close
Open

Huang-404-Q wants to merge 1 commit into
nodejs:mainfrom
Huang-404-Q:fix/http2-session-timeout-on-close

Conversation

@Huang-404-Q

Copy link
Copy Markdown

closeSession() set SESSION_FLAGS_DESTROYED and then called session.setTimeout(0). setStreamTimeout() returns early when the session is destroyed, so the idle timer stayed armed and retained the session until the server timeout fired.

Clear the timeout and remove its listeners before setting the destroyed flag.

Fixes: #66885

Test: test/parallel/test-http2-session-timeout-cleared-on-close.js asserts session.timeout === 0 after close. It fails on current main (actual: 30000, expected: 0) and passes with the reorder.

I verified the behavior against the installed Node v24.14.0 with an emulated patch (the repo's lib/ needs a full build to run in-tree); the test itself was run with that patch.

closeSession() set SESSION_FLAGS_DESTROYED and then called
session.setTimeout(0). setStreamTimeout() returns early when the session is
destroyed, so the idle timer stayed armed and retained the session until the
server timeout fired.

Clear the timeout and remove its listeners before setting the destroyed
flag.

Fixes: nodejs#66885
Signed-off-by: huang <13165998033@163.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http2 Issues and PRs related to the http2 subsystem. needs-ci PRs that need a full CI run. labels Oct 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

Caution

AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context.

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

Labels

agentscan:automated-account http2 Issues and 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: a destroyed Http2Session keeps its idle timer armed, so every closed session stays in memory until the server timeout fires

2 participants