Title: Error on Socket unref: Cannot read properties of undefined (reading 'Symbol(timeout)') · Issue #64490 · nodejs/node · GitHub
Open Graph Title: Error on Socket unref: Cannot read properties of undefined (reading 'Symbol(timeout)') · Issue #64490 · nodejs/node
X Title: Error on Socket unref: Cannot read properties of undefined (reading 'Symbol(timeout)') · Issue #64490 · nodejs/node
Description: Version v24.18.0 Platform Linux scatha 7.0.11-76070011-generic #202606011647~1780583630~22.04~70ad774 SMP PREEMPT_DYNAMIC Thu J x86_64 x86_64 x86_64 GNU/Linux Subsystem lib/internal/tls/wrap.js What steps will reproduce the bug? Very min...
Open Graph Description: Version v24.18.0 Platform Linux scatha 7.0.11-76070011-generic #202606011647~1780583630~22.04~70ad774 SMP PREEMPT_DYNAMIC Thu J x86_64 x86_64 x86_64 GNU/Linux Subsystem lib/internal/tls/wrap.js Wha...
X Description: Version v24.18.0 Platform Linux scatha 7.0.11-76070011-generic #202606011647~1780583630~22.04~70ad774 SMP PREEMPT_DYNAMIC Thu J x86_64 x86_64 x86_64 GNU/Linux Subsystem lib/internal/tls/wrap.js Wha...
Opengraph URL: https://github.com/nodejs/node/issues/64490
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Error on Socket unref: Cannot read properties of undefined (reading 'Symbol(timeout)')","articleBody":"### Version\n\nv24.18.0\n\n### Platform\n\n```text\nLinux scatha 7.0.11-76070011-generic #202606011647~1780583630~22.04~70ad774 SMP PREEMPT_DYNAMIC Thu J x86_64 x86_64 x86_64 GNU/Linux\n```\n\n### Subsystem\n\nlib/internal/tls/wrap.js\n\n### What steps will reproduce the bug?\n\nVery minimal (and artificial):\n\n```js\nconst net = require('net');\nconst s = new net.Socket();\ns._parent = undefined; // a chain link left `undefined` (see note on the trigger)\ns._unrefTimer();\n```\n\nMore representative, though the real case involved some library setting the handle to `undefined` whereas this does it explicitly:\n\n```js\nconst fs = require('fs');\nconst tls = require('tls');\n\n// self-signed cert: openssl req -x509 -newkey rsa:2048 -nodes \\\n// -keyout key.pem -out cert.pem -days 2 -subj \"/CN=localhost\"\nconst opts = { key: fs.readFileSync('key.pem'), cert: fs.readFileSync('cert.pem') };\n\nconst server = tls.createServer(opts, (conn) => {\n setTimeout(() => conn.write('x'), 50); // inbound record after the chain is corrupted\n});\n\nserver.listen(0, () => {\n const client = tls.connect(\n { port: server.address().port, rejectUnauthorized: false },\n () => { client._parent = undefined; }, // invariant violation (stands in for teardown race)\n );\n client.on('error', () => {});\n});\n```\n\n### How often does it reproduce? Is there a required condition?\n\nIt seems to happen very sporadically; we're seeing a few instances a day in a system that handles significant volume.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThe object should be unref-ed, and with no parent, the parent traversal should be a no-op.\n\n### What do you see instead?\n\n```\nTypeError: Cannot read properties of undefined (reading 'Symbol(timeout)')\n at TLSSocket._unrefTimer (node:net:529:10)\n at TLSWrap.onStreamRead (node:internal/stream_base_commons:172:23)\n```\n\n### Additional information\n\nIn `lib/net.js`, the parent chain is traversed with an exact equality check `s !== null` which fails if some library happens to null out the parent ref with `undefined`, instead. If this were a lax (`s != null`) check, the error ought to go away.\n\n```js\n const { kTimeout } = require('internal/timers'); // kTimeout = Symbol('timeout')\n\n Socket.prototype._unrefTimer = function _unrefTimer() {\n for (let s = this; s !== null; s = s._parent) {\n if (s[kTimeout])\n s[kTimeout].refresh();\n }\n };\n```","author":{"url":"https://github.com/haggholm","@type":"Person","name":"haggholm"},"datePublished":"2026-07-14T04:59:16Z","url":"https://github.com/nodejs/node/issues/64490"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8c500c4f-3fd8-7c4e-be15-b15a67542fb0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A1CE:38E6D:72A9BF:95CC23:6AED32F5 |
| html-safe-nonce | d7153cb804d5d9c38d2c2b011c994b445275bd2d36f474071ac01cf332d36018 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMUNFOjM4RTZEOjcyQTlCRjo5NUNDMjM6NkFFRDMyRjUiLCJ2aXNpdG9yX2lkIjoiNTc1NjU5MDk0MTU2NTg3NzY1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | bc6ecb921e8ae8451f7c18587acac0d7a7a3ef536ca5f47e65b80514d63af1bf |
| hovercard-subject-tag | issue:4879985130 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/64490/issue_layout |
| twitter:image | https://opengraph.githubassets.com/11d99c9f06b408fa894d8be7acbb3c032cf9f7a3a1ea60ba8ddcb84e18ca1544/nodejs/node/issues/64490 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/11d99c9f06b408fa894d8be7acbb3c032cf9f7a3a1ea60ba8ddcb84e18ca1544/nodejs/node/issues/64490 |
| og:image:alt | Version v24.18.0 Platform Linux scatha 7.0.11-76070011-generic #202606011647~1780583630~22.04~70ad774 SMP PREEMPT_DYNAMIC Thu J x86_64 x86_64 x86_64 GNU/Linux Subsystem lib/internal/tls/wrap.js Wha... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | haggholm |
| hostname | github.com |
| expected-hostname | github.com |
| None | e51d0b7b5ab34b1688c05b54c3ed17b8658b2fa9bca973a9c740683ccb12cf4a |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 59ebb7b901cc154ecc179a44f266fcf69f343b30 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width