Files
node/lib
Shivay-98 6586288a41 net: handle undefined parent in _unrefTimer and _destroy
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`.

[petter@hightouch.io: 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: https://github.com/nodejs/node/issues/64490
Refs: https://github.com/nodejs/node/pull/64491

Signed-off-by: Petter Häggholm <petter@hightouch.io>
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 <pimterry@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-08-21 19:33:38 -07:00
..
2020-02-18 22:15:50 -08:00
2026-07-05 08:04:44 +00:00
2020-10-21 01:26:34 +02:00
2026-08-06 09:25:51 +00:00
2026-04-05 10:12:21 +00:00
2026-06-21 19:42:03 +00:00
2026-05-31 12:49:51 -07:00
2026-08-13 15:25:11 +00:00
2024-01-12 16:09:48 +00:00
2025-12-10 16:12:28 +00:00
2025-12-22 16:14:46 +00:00
2026-07-25 23:56:46 -07:00
2025-09-04 11:58:50 +00:00
2026-02-21 16:30:23 +00:00
2026-04-01 10:09:41 +00:00
2026-04-26 19:36:36 +00:00
2026-05-23 18:43:31 +00:00
2025-08-05 13:45:41 +00:00