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 — net: handle undefined parent in _unrefTimer and _destroy by haggholm · Pull Request #64644 · nodejs/node

Conversation

@haggholm

@haggholm haggholm commented Jul 21, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

The fix and approach are from #64491 by @Shivay-98; opening from a fresh branch to land it, since that PR stalled awaiting the requested changes (unrelated commit dropped, failing test addressed, Signed-off-by added).

Socket.prototype._unrefTimer and Socket.prototype._destroy both walk the socket _parent chain with a strict !== null check. When teardown leaves a socket's _parent as undefined (for example a TLS socket layered over another stream), the loop steps onto undefined and throws

TypeError: Cannot read properties of undefined (reading 'Symbol(timeout)')
    at TLSSocket._unrefTimer (node:net)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons)

from an uncaught I/O callback, crashing the process. Switching both loops to a nullish != null check stops the walk on undefined as well.

The original PR fixed only _unrefTimer; its regression test also calls destroy(), which hits the same unpatched loop in _destroy, so that path is fixed and covered here too.

Fixes: #64490
Refs: #64491

Checklist
  • make -j4 test (UNIX) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

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

All reactions
@nodejs-github-bot

nodejs-github-bot commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Review requested:

  • @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 needs-ci PRs that need a full CI run. net Issues and PRs related to the net subsystem. labels Jul 21, 2026
@codecov

codecov Bot commented Jul 21, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.14%. Comparing base (ed63b19) to head (0fff075).
⚠️ Report is 553 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64644      +/-   ##
==========================================
- Coverage   92.01%   90.14%   -1.87%     
==========================================
  Files         381      741     +360     
  Lines      170167   242137   +71970     
  Branches    26075    45568   +19493     
==========================================
+ Hits       156585   218286   +61701     
- Misses      13291    15368    +2077     
- Partials      291     8483    +8192     
Files with missing lines Coverage Δ
lib/net.js 94.37% <100.00%> (+3.37%) ⬆️

... and 513 files with indirect coverage changes

🚀 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.
All reactions

Sorry, something went wrong.

Uh oh!

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

@haggholm
haggholm force-pushed the fix/net-unref-timer-parent-chain branch from 6b91d30 to ae8a326 Compare July 21, 2026 16:44
@haggholm

haggholm commented Jul 21, 2026

Copy link
Copy Markdown
Author

Cc. @aduh95 who was active in the original PR.

Note: I've never contributed to Node and basically do not know what I am doing.

All reactions

Sorry, something went wrong.

Uh oh!

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

pimterry
pimterry reviewed Jul 21, 2026
View reviewed changes
Comment thread lib/net.js Resolved

Uh oh!

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

@pimterry

pimterry commented Jul 21, 2026

Copy link
Copy Markdown
Member

Note: I've never contributed to Node and basically do not know what I am doing.

Thanks for the PR @haggholm, no worries, this looks good to me and all going in the right direction. Very helpful picking up stalled work like this. I have a minor comment here that it'd be nice to clean up (you can just push another commit and they'll be squashed together at merge automatically) but otherwise everything looks great.

Don't worry too much about the test-internet failure, I strongly suspect something flaky is going on there... Could be us, could be github actions, hard to say.

All reactions

Sorry, something went wrong.

Uh oh!

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

@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]>
@haggholm
haggholm force-pushed the fix/net-unref-timer-parent-chain branch from ae8a326 to 0fff075 Compare July 21, 2026 21:06
pimterry
pimterry approved these changes Jul 21, 2026
View reviewed changes
@pimterry pimterry added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. author ready PRs with CI started, the required approvals, and no outstanding review comments. labels Jul 22, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jul 22, 2026
@nodejs-github-bot

nodejs-github-bot commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/75002/

All reactions

Sorry, something went wrong.

Uh oh!

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

mcollina
mcollina approved these changes Jul 22, 2026
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

lgtm

Sorry, something went wrong.

Uh oh!

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

All reactions
@pimterry

pimterry commented Jul 22, 2026

Copy link
Copy Markdown
Member

Don't worry too much about the test-internet failure, I strongly suspect something flaky is going on there... Could be us, could be github actions, hard to say.

More specifically, I see now it's been broken on main but will be fixed by #64624 imminently, we'll just need to wait until that's merged then rebase this.

All reactions

Sorry, something went wrong.

Uh oh!

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

@nodejs-github-bot

nodejs-github-bot commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/75010/

All reactions

Sorry, something went wrong.

Uh oh!

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

Ethan-Arrowood
Ethan-Arrowood approved these changes Jul 23, 2026
View reviewed changes
@Ethan-Arrowood Ethan-Arrowood added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jul 23, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jul 23, 2026
@nodejs-github-bot

nodejs-github-bot commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/75075/

All reactions

Sorry, something went wrong.

Uh oh!

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

@pimterry

pimterry commented Jul 24, 2026

Copy link
Copy Markdown
Member

More specifically, I see now it's been broken on main but will be fixed by #64624 imminently, we'll just need to wait until that's merged then rebase this.

#64624 has now been merged to fix test-internet. If you rebase and force push, this should be good to go.

All reactions

Sorry, something went wrong.

Uh oh!

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

lpinca
lpinca approved these changes Jul 24, 2026
View reviewed changes
@lpinca

lpinca commented Jul 24, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

My only observation is that _parent is a "private" property so its value should not be changed by user code.

All reactions

Sorry, something went wrong.

Uh oh!

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

@nodejs-github-bot

This comment was marked as resolved.

Sign in to view
@nodejs-github-bot

nodejs-github-bot commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/76161/

All reactions

Sorry, something went wrong.

Uh oh!

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

@trivikr trivikr added the commit-queue PRs queued for automated landing through the Commit Queue. label Aug 22, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. and removed commit-queue PRs queued for automated landing through the Commit Queue. labels Aug 22, 2026
@nodejs-github-bot

nodejs-github-bot commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/64644
✔  Done loading data for nodejs/node/pull/64644
----------------------------------- PR info ------------------------------------
Title      net: handle undefined parent in _unrefTimer and _destroy (#64644)
Author     Petter <[email protected]> (@haggholm, first-time contributor)
Branch     haggholm:fix/net-unref-timer-parent-chain -> nodejs:main
Labels     net, author ready, needs-ci, commit-queue
Commits    1
 - net: handle undefined parent in _unrefTimer and _destroy
Committers 1
 - Petter Häggholm <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/64644
Fixes: https://github.com/nodejs/node/issues/64490
Refs: https://github.com/nodejs/node/pull/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]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/64644
Fixes: https://github.com/nodejs/node/issues/64490
Refs: https://github.com/nodejs/node/pull/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]>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Tue, 21 Jul 2026 05:41:51 GMT
   ✔  Approvals: 4
   ✔  - Tim Perry (@pimterry): https://github.com/nodejs/node/pull/64644#pullrequestreview-4749162536
   ✔  - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/64644#pullrequestreview-4752502041
   ✔  - Ethan Arrowood (@Ethan-Arrowood): https://github.com/nodejs/node/pull/64644#pullrequestreview-4760962100
   ✔  - Luigi Pinca (@lpinca): https://github.com/nodejs/node/pull/64644#pullrequestreview-4776083636
   ✘  GitHub CI is still running
   ℹ  Last Full PR CI on 2026-08-21T15:39:32Z: https://ci.nodejs.org/job/node-test-pull-request/76161/
- Querying data for job/node-test-pull-request/76161/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
   ⚠  PR author is a new contributor: @haggholm([email protected])
   ⚠  - commit 0fff075b3468 is authored by [email protected]
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/32544647199
All reactions

Sorry, something went wrong.

Uh oh!

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

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]>
@trivikr

trivikr commented Aug 22, 2026

Copy link
Copy Markdown
Member

Landed in 6586288

All reactions

Sorry, something went wrong.

Uh oh!

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

@trivikr trivikr closed this Aug 22, 2026
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]>
@github-actions github-actions Bot mentioned this pull request Aug 25, 2026
2026-08-26, Version 26.8.0 (Current) #65551
Merged
@haggholm

haggholm commented Aug 26, 2026

Copy link
Copy Markdown
Author

Will this make it into a 24.x backport, or only be available in 26.x? (I really, really hope the answer will be the former…)

All reactions

Sorry, something went wrong.

Uh oh!

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

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]>
@github-actions github-actions Bot mentioned this pull request Sep 7, 2026
2026-09-08, Version 24.21.0 'Krypton' (LTS) #65873
Merged
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

@mcollina mcollina mcollina approved these changes
@lpinca lpinca lpinca approved these changes
@pimterry pimterry pimterry approved these changes
@Ethan-Arrowood Ethan-Arrowood Ethan-Arrowood approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. 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.

8 participants

@haggholm @nodejs-github-bot @pimterry @lpinca @trivikr @mcollina @Ethan-Arrowood @Shivay-98
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.