Skip to content

Fix unref timer parent #64490#64491

Open
Shivay-98 wants to merge 2 commits into
nodejs:mainfrom
Shivay-98:fix-unref-timer-parent
Open

Fix unref timer parent #64490#64491
Shivay-98 wants to merge 2 commits into
nodejs:mainfrom
Shivay-98:fix-unref-timer-parent

Conversation

@Shivay-98

Copy link
Copy Markdown

Summary

Socket.prototype._unrefTimer() traverses the _parent chain using
for (let s = this; s !== null; s = s._parent).

If _parent becomes undefined, the loop performs one additional
iteration and attempts to access undefined[kTimeout], resulting in:

TypeError: Cannot read properties of undefined (reading 'Symbol(timeout)')

Replace the strict null check with a nullish check (s != null) so
the traversal terminates for both null and undefined.

A regression test has been added to cover this case.

Fixes: #64490

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @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. net Issues and PRs related to the net subsystem. labels Jul 14, 2026
@aduh95

aduh95 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Can you remove the additional commit and fix the failing test? Also, the commit should have the Signed-off-by trailer

@marco1991layker-code

This comment was marked as low quality.

@marco1991layker-code marco1991layker-code left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Each property is an array containing all values received for that header.

@marco1991layker-code marco1991layker-code left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1

Comment thread lib/net.js
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. net Issues and PRs related to the net subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error on Socket unref: Cannot read properties of undefined (reading 'Symbol(timeout)')

4 participants