GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix unref timer parent #64490 by Shivay-98 · Pull Request #64491 · nodejs/node

Conversation

@Shivay-98

@Shivay-98 Shivay-98 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Shivay-98 added 2 commits July 14, 2026 10:24
@Shivay-98
http2: add headersDistinct to Http2ServerRequest
cabf67a
Signed-off-by: Shivay-98 <[email protected]>
@Shivay-98
net: handle undefined parent in _unrefTimer
c7ac7e0
@nodejs-github-bot

nodejs-github-bot commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/http2
  • @nodejs/net
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@marco1991layker-code

This comment was marked as low quality.

Sign in to view
marco1991layker-code

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

marco1991layker-code

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

marco1991layker-code
marco1991layker-code reviewed Jul 14, 2026
View reviewed changes
Comment thread lib/net.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@haggholm haggholm mentioned this pull request Jul 21, 2026
net: handle undefined parent in _unrefTimer and _destroy #64644
Closed
3 tasks done
haggholm pushed a commit to hightouchio/node that referenced this pull request Jul 21, 2026
@Shivay-98 @haggholm
net: handle undefined parent in _unrefTimer and _destroy
0fff075
The fix and approach are from nodejs#64491 by Shivay-98; this reopens it to
get it landed, since the original stalled awaiting requested changes.

`Socket.prototype._unrefTimer` and `Socket.prototype._destroy` both walk
the `_parent` chain with a strict `!== null` check. During connection
teardown a socket's `_parent` can be left `undefined` (for example a TLS
socket layered over another stream), so the loop steps onto `undefined`
and reads a property off it, throwing a TypeError:

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

from an uncaught I/O callback and crashing the process.

Using a nullish (`!= null`) check terminates the walk on both `null` and
`undefined`.

[[email protected]: apply the same fix to the identical loop in
`_destroy`, which the original regression test already exercised via
`destroy()`; add direct unit coverage for both paths.]

Fixes: nodejs#64490
Refs: nodejs#64491

Signed-off-by: Petter Häggholm <[email protected]>
trivikr pushed a commit that referenced this pull request Aug 22, 2026
@Shivay-98 @trivikr
net: handle undefined parent in _unrefTimer and _destroy
6586288
The fix and approach are from #64491 by Shivay-98; this reopens it to
get it landed, since the original stalled awaiting requested changes.

`Socket.prototype._unrefTimer` and `Socket.prototype._destroy` both walk
the `_parent` chain with a strict `!== null` check. During connection
teardown a socket's `_parent` can be left `undefined` (for example a TLS
socket layered over another stream), so the loop steps onto `undefined`
and reads a property off it, throwing a TypeError:

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

from an uncaught I/O callback and crashing the process.

Using a nullish (`!= null`) check terminates the walk on both `null` and
`undefined`.

[[email protected]: apply the same fix to the identical loop in
`_destroy`, which the original regression test already exercised via
`destroy()`; add direct unit coverage for both paths.]

Fixes: #64490
Refs: #64491

Signed-off-by: Petter Häggholm <[email protected]>
PR-URL: #64644
Fixes: #64490
Refs: #64491
Reviewed-By: Tim Perry <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Ethan Arrowood <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
aduh95 pushed a commit that referenced this pull request Aug 25, 2026
@Shivay-98 @aduh95
net: handle undefined parent in _unrefTimer and _destroy
b261c44
The fix and approach are from #64491 by Shivay-98; this reopens it to
get it landed, since the original stalled awaiting requested changes.

`Socket.prototype._unrefTimer` and `Socket.prototype._destroy` both walk
the `_parent` chain with a strict `!== null` check. During connection
teardown a socket's `_parent` can be left `undefined` (for example a TLS
socket layered over another stream), so the loop steps onto `undefined`
and reads a property off it, throwing a TypeError:

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

from an uncaught I/O callback and crashing the process.

Using a nullish (`!= null`) check terminates the walk on both `null` and
`undefined`.

[[email protected]: apply the same fix to the identical loop in
`_destroy`, which the original regression test already exercised via
`destroy()`; add direct unit coverage for both paths.]

Fixes: #64490
Refs: #64491

Signed-off-by: Petter Häggholm <[email protected]>
PR-URL: #64644
Fixes: #64490
Refs: #64491
Reviewed-By: Tim Perry <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Ethan Arrowood <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
aduh95 pushed a commit that referenced this pull request Aug 25, 2026
@Shivay-98 @aduh95
net: handle undefined parent in _unrefTimer and _destroy
646221a
The fix and approach are from #64491 by Shivay-98; this reopens it to
get it landed, since the original stalled awaiting requested changes.

`Socket.prototype._unrefTimer` and `Socket.prototype._destroy` both walk
the `_parent` chain with a strict `!== null` check. During connection
teardown a socket's `_parent` can be left `undefined` (for example a TLS
socket layered over another stream), so the loop steps onto `undefined`
and reads a property off it, throwing a TypeError:

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

from an uncaught I/O callback and crashing the process.

Using a nullish (`!= null`) check terminates the walk on both `null` and
`undefined`.

[[email protected]: apply the same fix to the identical loop in
`_destroy`, which the original regression test already exercised via
`destroy()`; add direct unit coverage for both paths.]

Fixes: #64490
Refs: #64491

Signed-off-by: Petter Häggholm <[email protected]>
PR-URL: #64644
Fixes: #64490
Refs: #64491
Reviewed-By: Tim Perry <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Ethan Arrowood <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
aduh95 pushed a commit that referenced this pull request Aug 27, 2026
@Shivay-98 @aduh95
net: handle undefined parent in _unrefTimer and _destroy
9ad61b8
The fix and approach are from #64491 by Shivay-98; this reopens it to
get it landed, since the original stalled awaiting requested changes.

`Socket.prototype._unrefTimer` and `Socket.prototype._destroy` both walk
the `_parent` chain with a strict `!== null` check. During connection
teardown a socket's `_parent` can be left `undefined` (for example a TLS
socket layered over another stream), so the loop steps onto `undefined`
and reads a property off it, throwing a TypeError:

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

from an uncaught I/O callback and crashing the process.

Using a nullish (`!= null`) check terminates the walk on both `null` and
`undefined`.

[[email protected]: apply the same fix to the identical loop in
`_destroy`, which the original regression test already exercised via
`destroy()`; add direct unit coverage for both paths.]

Fixes: #64490
Refs: #64491

Signed-off-by: Petter Häggholm <[email protected]>
PR-URL: #64644
Fixes: #64490
Refs: #64491
Reviewed-By: Tim Perry <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Ethan Arrowood <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
aduh95 pushed a commit that referenced this pull request Sep 7, 2026
@Shivay-98 @aduh95
net: handle undefined parent in _unrefTimer and _destroy
05cc430
The fix and approach are from #64491 by Shivay-98; this reopens it to
get it landed, since the original stalled awaiting requested changes.

`Socket.prototype._unrefTimer` and `Socket.prototype._destroy` both walk
the `_parent` chain with a strict `!== null` check. During connection
teardown a socket's `_parent` can be left `undefined` (for example a TLS
socket layered over another stream), so the loop steps onto `undefined`
and reads a property off it, throwing a TypeError:

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

from an uncaught I/O callback and crashing the process.

Using a nullish (`!= null`) check terminates the walk on both `null` and
`undefined`.

[[email protected]: apply the same fix to the identical loop in
`_destroy`, which the original regression test already exercised via
`destroy()`; add direct unit coverage for both paths.]

Fixes: #64490
Refs: #64491

Signed-off-by: Petter Häggholm <[email protected]>
PR-URL: #64644
Fixes: #64490
Refs: #64491
Reviewed-By: Tim Perry <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Ethan Arrowood <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
aduh95 pushed a commit that referenced this pull request Sep 7, 2026
@Shivay-98 @aduh95
net: handle undefined parent in _unrefTimer and _destroy
f45ef73
The fix and approach are from #64491 by Shivay-98; this reopens it to
get it landed, since the original stalled awaiting requested changes.

`Socket.prototype._unrefTimer` and `Socket.prototype._destroy` both walk
the `_parent` chain with a strict `!== null` check. During connection
teardown a socket's `_parent` can be left `undefined` (for example a TLS
socket layered over another stream), so the loop steps onto `undefined`
and reads a property off it, throwing a TypeError:

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

from an uncaught I/O callback and crashing the process.

Using a nullish (`!= null`) check terminates the walk on both `null` and
`undefined`.

[[email protected]: apply the same fix to the identical loop in
`_destroy`, which the original regression test already exercised via
`destroy()`; add direct unit coverage for both paths.]

Fixes: #64490
Refs: #64491

Signed-off-by: Petter Häggholm <[email protected]>
PR-URL: #64644
Fixes: #64490
Refs: #64491
Reviewed-By: Tim Perry <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Ethan Arrowood <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@marco1991layker-code marco1991layker-code marco1991layker-code left review comments
Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

http2 Issues and 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

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@Shivay-98 @nodejs-github-bot @aduh95 @marco1991layker-code
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.