Title: child_process: timeout option never clears on spawn-time failure (ENOENT etc), hangs process for full timeoutMs · Issue #65504 · nodejs/node · GitHub
Open Graph Title: child_process: timeout option never clears on spawn-time failure (ENOENT etc), hangs process for full timeoutMs · Issue #65504 · nodejs/node
X Title: child_process: timeout option never clears on spawn-time failure (ENOENT etc), hangs process for full timeoutMs · Issue #65504 · nodejs/node
Description: Version v24.5.0 Platform Microsoft Windows NT 10.0.26200.0 x64 Subsystem child_process What steps will reproduce the bug? const {spawn} = require('child_process'); const start = Date.now(); const child = spawn('node', ['--version'], {cwd...
Open Graph Description: Version v24.5.0 Platform Microsoft Windows NT 10.0.26200.0 x64 Subsystem child_process What steps will reproduce the bug? const {spawn} = require('child_process'); const start = Date.now(); const c...
X Description: Version v24.5.0 Platform Microsoft Windows NT 10.0.26200.0 x64 Subsystem child_process What steps will reproduce the bug? const {spawn} = require('child_process'); const start = Date.now();...
Opengraph URL: https://github.com/nodejs/node/issues/65504
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"child_process: timeout option never clears on spawn-time failure (ENOENT etc), hangs process for full timeoutMs","articleBody":"### Version\n\nv24.5.0\n\n### Platform\n\nMicrosoft Windows NT 10.0.26200.0 x64\n\n### Subsystem\n\nchild_process\n\n### What steps will reproduce the bug?\n\n```js\nconst {spawn} = require('child_process');\nconst start = Date.now();\nconst child = spawn('node', ['--version'], {cwd: 'Z:\\\\nope', timeout: 5000});\nchild.on('error', e => console.log('error', Date.now() - start, e.code));\nprocess.on('exit', () => console.log('exiting', Date.now() - start));\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways, with `timeout` set and a spawn that fails at the OS level (ENOENT here).\n\n### What is the expected behavior? Why is that the expected behavior?\n\nProcess exits within a few ms of `error`.\n\n### What do you see instead?\n\n```\nerror 12 ENOENT\nexiting 5026\n```\n\nHangs until `timeout` elapses.\n\n### Additional information\n\n`timeout`'s only cleanup is `child.once('exit', clearTimeout)`. On a spawn-time failure `onexit` gets `exitCode \u003c 0` and emits `error`, not `exit` — so the timer never clears. `unref()` doesn't help either.\n\nNo existing issue found for this exact case (#43704, #51561 are different). Fix: clear the timer on `error` too, or use `close` instead of `exit`. Can PR once there's a preferred direction.\n","author":{"url":"https://github.com/kishore280","@type":"Person","name":"kishore280"},"datePublished":"2026-08-23T17:05:19Z","url":"https://github.com/nodejs/node/issues/65504"}
| 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:03dfe087-994c-c620-f6f8-f81623f2c9ee |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DBFE:1E2715:7B1516:9F8C10:6AED32E6 |
| html-safe-nonce | 91c85aae4a0c43ce1e7fbd9964e7202923682dabdbae0f3f17d049d46b340e9f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkZFOjFFMjcxNTo3QjE1MTY6OUY4QzEwOjZBRUQzMkU2IiwidmlzaXRvcl9pZCI6IjM5MjQ4NTgwOTAzMTMwMzY1MTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7ecad843148d38c52d3374077f9ab22a74f46bf02510de8b96ebd40ef89346d9 |
| hovercard-subject-tag | issue:5228043951 |
| 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/65504/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eff68419f982a592a1c592da7d155f8e7276385cd4093a63bd3fb46c581c1609/nodejs/node/issues/65504 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eff68419f982a592a1c592da7d155f8e7276385cd4093a63bd3fb46c581c1609/nodejs/node/issues/65504 |
| og:image:alt | Version v24.5.0 Platform Microsoft Windows NT 10.0.26200.0 x64 Subsystem child_process What steps will reproduce the bug? const {spawn} = require('child_process'); const start = Date.now(); const c... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kishore280 |
| 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