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 — child_process: add subprocess.timedOut by marcopiraccini · Pull Request #66639 · nodejs/node

Conversation

@marcopiraccini

@marcopiraccini marcopiraccini commented Oct 10, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

When a child process receives its kill signal because timeout expired, callers cannot distinguish that from a signal sent for another reason.

Add subprocess.timedOut for spawn(), exec(), execFile() and fork(), and error.timedOut on errors returned by exec() and execFile(). The flag becomes true only when the timeout successfully sends the signal; it does not guarantee that the process has terminated.

This revisits #51608, which proposed the same property for #51561 but closed without landing. That review requested documentation and noted failing CI. This PR includes API documentation and regression tests for timeout expiry, normal exit, manual termination, non-timeout errors, and descendants keeping stdio open after the child exits.

Fixes: #51561
Refs: #51608

Sorry, something went wrong.

Uh oh!

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

All reactions
@marcopiraccini
child_process: add subprocess.timedOut
3989ee0
When the timeout option of spawn(), exec(), execFile() or fork()
expires, the child is sent the kill signal and exits with that signal.
Nothing told the caller that the timeout was the reason.

Set subprocess.timedOut to true when the kill signal is sent because of
the timeout, and add the same flag to the error passed to the exec()
and execFile() callback.

Fixes: nodejs#51561
Refs: nodejs#51608
Signed-off-by: marcopiraccini <[email protected]>
@nodejs-github-bot nodejs-github-bot added child_process Issues and PRs related to the child_process subsystem. needs-ci PRs that need a full CI run. labels Oct 10, 2026
@marcopiraccini
marcopiraccini marked this pull request as ready for review October 10, 2026 09:25
ShogunPanda
ShogunPanda approved these changes Oct 10, 2026
View reviewed changes
@codecov

codecov Bot commented Oct 10, 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.65%. Comparing base (ae5a0f4) to head (cc9652e).
⚠️ Report is 300 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66639      +/-   ##
==========================================
- Coverage   92.78%   90.65%   -2.13%     
==========================================
  Files         422      797     +375     
  Lines      193692   278275   +84583     
  Branches    29881    53518   +23637     
==========================================
+ Hits       179718   252282   +72564     
- Misses      13645    16379    +2734     
- Partials      329     9614    +9285     
Files with missing lines Coverage Δ
lib/child_process.js 91.44% <100.00%> (+0.04%) ⬆️
lib/internal/child_process.js 95.13% <100.00%> (+1.68%) ⬆️

... and 549 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.

@inoway46 inoway46 added semver-minor PRs that contain new features and should be released in the next minor version. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Oct 11, 2026
@inoway46

inoway46 commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Adding semver-minor since this introduces the public subprocess.timedOut and error.timedOut properties.

All reactions

Sorry, something went wrong.

Uh oh!

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

@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 Oct 11, 2026
@nodejs-github-bot

This comment has been minimized.

Sign in to view
@inoway46 inoway46 added the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Oct 12, 2026
@github-actions github-actions Bot added resume-ci-failed Resuming CI with the resume-ci label failed and requires manual intervention. and removed resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. labels Oct 12, 2026
@github-actions

github-actions Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Failed to resume CI

   ✖  test/parallel/test-child-process-spawn-timeout-kill-signal.js
   ℹ  https://ci.nodejs.org/job/node-test-commit-osx/nodes=macos15-x64/74044/consoleText
✖  Refusing to resume CI: failures reference files changed by this PR
Full Auto Start CI output
�[36m⠋�[39m Validating Jenkins credentials
�[36m⠋�[39m Validating Jenkins credentials
✔  Jenkins credentials valid
�[36m⠙�[39m Looking for CI runs for pull request 66639
�[36m⠙�[39m Looking for CI runs for pull request 66639
�[36m⠙�[39m Getting PR from nodejs/node/pull/66639
�[36m⠙�[39m Getting reviews from nodejs/node/pull/66639
�[36m⠙�[39m Getting comments from nodejs/node/pull/66639
✔  Found PR CI job 78312
�[36m⠹�[39m Querying data for job/node-test-pull-request/78312/
�[36m⠹�[39m Querying data for job/node-test-pull-request/78312/
�[36m⠹�[39m Querying API for job/node-test-pull-request/78312/
✔  Build data downloaded
�[36m⠹�[39m Checking whether PR CI job 78312 can be resumed
�[36m⠹�[39m Checking whether PR CI job 78312 can be resumed
✔  Jenkins offers a Resume build action
�[36m⠸�[39m Checking failures against changed PR files
�[36m⠸�[39m Checking failures against changed PR files
�[36m⠼�[39m Querying data for job/node-test-pull-request/78312/
�[36m⠼�[39m Querying API for job/node-test-pull-request/78312/
✔  Build data downloaded
�[36m⠼�[39m Querying failures of job/node-test-commit/93178/
�[36m⠼�[39m Querying failures of job/node-test-commit/93178/
�[36m⠼�[39m Querying API for job/node-test-commit-osx/74044/
�[36m⠼�[39m Querying API for job/node-test-commit-linux-containered/59803/
�[36m⠴�[39m Querying API for job/node-test-commit-osx/nodes=macos15-x64/74044/
�[36m⠴�[39m Querying console text for job/node-test-commit-osx/nodes=macos15-x64/74044/
�[36m⠦�[39m Querying API for job/node-test-commit-linux-containered/nodes=ubuntu2404_sharedlibs_withoutssl_x64/59803/
�[36m⠧�[39m Querying console text for job/node-test-commit-linux-containered/nodes=ubuntu2404_sharedlibs_withoutssl_x64/59803/
✔  Data downloaded
   ✖  test/parallel/test-child-process-spawn-timeout-kill-signal.js
   ℹ  https://ci.nodejs.org/job/node-test-commit-osx/nodes=macos15-x64/74044/consoleText
not ok 334 parallel/test-child-process-spawn-timeout-kill-signal
  ---
  duration_ms: 894.85200
  severity: fail
  exitcode: 1
  stack: |-
    node:internal/assert/utils:146
      throw error;
      ^
    
    AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
    
    null !== 0
    
        at ChildProcess.<anonymous> (/Users/admin/build/workspace/node-test-commit-osx/nodes/macos15-x64/test/parallel/test-child-process-spawn-timeout-kill-signal.js:41:12)
        at ChildProcess.<anonymous> (/Users/admin/build/workspace/node-test-commit-osx/nodes/macos15-x64/test/common/index.js:512:15)
        at ChildProcess.emit (node:events:514:20)
        at ChildProcess._handle.onexit (node:internal/child_process:324:12) {
      generatedMessage: true,
      code: 'ERR_ASSERTION',
      actual: null,
      expected: 0,
      operator: 'strictEqual',
      diff: 'simple'
    }
    
    Node.js v27.0.0-pre
  ...
✖  Refusing to resume CI: failures reference files changed by this PR

View workflow run

All reactions

Sorry, something went wrong.

Uh oh!

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

@inoway46

inoway46 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

#66639 (comment)
It looks like the newly added test is failing.

All reactions

Sorry, something went wrong.

Uh oh!

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

marcopiraccini added 2 commits October 12, 2026 09:59
@marcopiraccini
test: do not depend on startup time in timedOut tests
5448b7f
The cases where the timeout expires after the child exited gave the
child 500 ms to start, spawn a descendant and exit, which a loaded
macOS worker did not meet, so the timer killed the child instead.

Let the child print the pid of the descendant and end it from the
test once the timer has fired, with a timeout of three seconds.

Signed-off-by: marcopiraccini <[email protected]>
@marcopiraccini
test: do not depend on startup time in timedOut tests
6acb1e8
The cases where the timeout expires after the child exited gave the
child 500 ms to start, spawn a descendant and exit, which a loaded
macOS worker did not meet, so the timer killed the child instead.

Let the child print the pid of the descendant and end it from the
test once the timer has fired, with a timeout of five seconds.

Signed-off-by: marcopiraccini <[email protected]>
@marcopiraccini

marcopiraccini commented Oct 12, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

#66639 (comment) It looks like the newly added test is failing.

Updated, can you trigger (jenkins) ci again? @ShogunPanda ?

All reactions

Sorry, something went wrong.

Uh oh!

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

@inoway46

inoway46 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

I can’t trigger Jenkins CI myself. We need a new collaborator approval.

All reactions

Sorry, something went wrong.

Uh oh!

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

@panva panva added commit-queue-squash PRs the Commit Queue should land as one squashed commit. and removed resume-ci-failed Resuming CI with the resume-ci label failed and requires manual intervention. labels Oct 19, 2026
@nodejs-github-bot

nodejs-github-bot commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

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

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 Oct 26, 2026

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@marcopiraccini
test: detach the descendant in the timedOut tests
cc9652e
  On Windows libuv assigns every non-detached child to the job object of
  its parent, which is closed when the parent exits and kills the
  processes it contains. The descendant that is meant to keep the stdio of
  the child open died with the child, so process.kill() on its pid failed
  with ESRCH once the timer fired. Spawn it detached, so that it outlives
  the child on every platform.

Signed-off-by: marcopiraccini <[email protected]>
ShogunPanda
ShogunPanda approved these changes Oct 28, 2026
View reviewed changes
@ShogunPanda ShogunPanda 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 Oct 29, 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 Oct 29, 2026
@nodejs-github-bot

nodejs-github-bot commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@ShogunPanda ShogunPanda added the commit-queue PRs queued for automated landing through the Commit Queue. label Oct 29, 2026
@nodejs-github-bot
nodejs-github-bot merged commit c2591da into nodejs:main Oct 29, 2026
65 checks passed

Uh oh!

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

@nodejs-github-bot

nodejs-github-bot commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Landed in c2591da

All reactions

Sorry, something went wrong.

Uh oh!

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

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Oct 29, 2026
aduh95 pushed a commit that referenced this pull request Nov 11, 2026
@marcopiraccini @aduh95
child_process: add subprocess.timedOut
33d4e6c
When the timeout option of spawn(), exec(), execFile() or fork()
expires, the child is sent the kill signal and exits with that signal.
Nothing told the caller that the timeout was the reason.

Set subprocess.timedOut to true when the kill signal is sent because of
the timeout, and add the same flag to the error passed to the exec()
and execFile() callback.

Fixes: #51561
Refs: #51608
Signed-off-by: marcopiraccini <[email protected]>
PR-URL: #66639
Reviewed-By: Paolo Insogna <[email protected]>
@github-actions github-actions Bot mentioned this pull request Nov 11, 2026
2026-11-12, Version 27.0.0-alpha.0.1.0 (Alpha) #67415
Merged
nodejs-github-bot added a commit that referenced this pull request Nov 11, 2026
@nodejs-github-bot
2026-11-12, Version 27.0.0-alpha.0.1.0 (Alpha)
dd138af
Notable changes:

child_process:
  * (SEMVER-MINOR) add subprocess.timedOut (Marco) #66639
crypto:
  * (SEMVER-MINOR) make X.509 inspection guards explicit (Filip Skokan) #67245
  * (SEMVER-MINOR) add X.509 generation with CSR support (Filip Skokan) #67245
dns:
  * (SEMVER-MINOR) coalesce identical concurrent lookup() requests (Orgad Shaneh) #62599
doc:
  * add efekrskl to collaborators (Efe Karasakal) #67376
  * add Philipp Dunkel to contributors (Philipp Dunkel) #67378
  * add christianaurichzm to collaborators (Christian Aurich Zanettini Martins) #67377
http:
  * (SEMVER-MINOR) batch body spans per parser execute (Guilherme Araújo) #67187
sea:
  * (SEMVER-MINOR) generate a compile cache for the VFS modules (Matteo Collina) #66768
worker:
  * (SEMVER-MINOR) preload streams into startup snapshot (Matteo Collina) #66311

PR-URL: #67415
aduh95 pushed a commit that referenced this pull request Nov 12, 2026
@nodejs-github-bot @aduh95
2026-11-12, Version 27.0.0-alpha.0.1.0 (Alpha)
4f23168
Notable changes:

child_process:
  * (SEMVER-MINOR) add subprocess.timedOut (Marco) #66639
crypto:
  * (SEMVER-MINOR) make X.509 inspection guards explicit (Filip Skokan) #67245
  * (SEMVER-MINOR) add X.509 generation with CSR support (Filip Skokan) #67245
dns:
  * (SEMVER-MINOR) coalesce identical concurrent lookup() requests (Orgad Shaneh) #62599
doc:
  * add efekrskl to collaborators (Efe Karasakal) #67376
  * add Philipp Dunkel to contributors (Philipp Dunkel) #67378
  * add christianaurichzm to collaborators (Christian Aurich Zanettini Martins) #67377
http:
  * (SEMVER-MINOR) batch body spans per parser execute (Guilherme Araújo) #67187
sea:
  * (SEMVER-MINOR) generate a compile cache for the VFS modules (Matteo Collina) #66768
worker:
  * (SEMVER-MINOR) preload streams into startup snapshot (Matteo Collina) #66311

PR-URL: #67415
aduh95 pushed a commit that referenced this pull request Nov 12, 2026
@marcopiraccini @aduh95
child_process: add subprocess.timedOut
c1b8f0e
When the timeout option of spawn(), exec(), execFile() or fork()
expires, the child is sent the kill signal and exits with that signal.
Nothing told the caller that the timeout was the reason.

Set subprocess.timedOut to true when the kill signal is sent because of
the timeout, and add the same flag to the error passed to the exec()
and execFile() callback.

Fixes: #51561
Refs: #51608
Signed-off-by: marcopiraccini <[email protected]>
PR-URL: #66639
Reviewed-By: Paolo Insogna <[email protected]>
@github-actions github-actions Bot mentioned this pull request Nov 20, 2026
2026-11-30, Version 26.14.0 'Lithium' (LTS) #67664
Open
nodejs-github-bot added a commit that referenced this pull request Nov 20, 2026
@nodejs-github-bot
2026-11-30, Version 26.14.0 'Lithium' (LTS)
7692ae4
Notable changes:

child_process:
  * (SEMVER-MINOR) add subprocess.timedOut (Marco) #66639
doc:
  * add efekrskl to collaborators (Efe Karasakal) #67376
  * add Philipp Dunkel to contributors (Philipp Dunkel) #67378
  * add christianaurichzm to collaborators (Christian Aurich Zanettini Martins) #67377
fs:
  * (SEMVER-MINOR) add mkstemp() (Marco) #66484
http:
  * (SEMVER-MINOR) batch body spans per parser execute (Guilherme Araújo) #67187
lib:
  * (SEMVER-MINOR) speed up AbortSignal (Robert Nagy) #66789
module:
  * (SEMVER-MINOR) add --experimental-strip-private-modules (Marco Ippolito) #63869
process:
  * (SEMVER-MINOR) return unregister fn from finalization (Matteo Collina) #66482
test_runner:
  * use AsyncLocalStorage instead of async_hooks (Matteo Collina) #66795
  * (SEMVER-MINOR) add mockReturnValue and promise helpers (Guilherme Araújo) #66631
worker:
  * (SEMVER-MINOR) preload streams into startup snapshot (Matteo Collina) #66311
zlib:
  * (SEMVER-MINOR) add crc32c (Philipp Dunkel) #66828

PR-URL: #67664
aduh95 added a commit that referenced this pull request Nov 21, 2026
@aduh95
2026-11-30, Version 26.14.0 'Lithium' (LTS)
193c052
Notable changes:

child_process:
  * (SEMVER-MINOR) add subprocess.timedOut (Marco) #66639
doc:
  * add efekrskl to collaborators (Efe Karasakal) #67376
  * add Philipp Dunkel to contributors (Philipp Dunkel) #67378
  * add christianaurichzm to collaborators (Christian Aurich Zanettini Martins) #67377
fs:
  * (SEMVER-MINOR) add mkstemp() (Marco) #66484
http:
  * (SEMVER-MINOR) batch body spans per parser execute (Guilherme Araújo) #67187
lib:
  * (SEMVER-MINOR) speed up AbortSignal (Robert Nagy) #66789
module:
  * (SEMVER-MINOR) add --experimental-strip-private-modules (Marco Ippolito) #63869
process:
  * (SEMVER-MINOR) return unregister fn from finalization (Matteo Collina) #66482
test_runner:
  * use AsyncLocalStorage instead of async_hooks (Matteo Collina) #66795
  * (SEMVER-MINOR) add mockReturnValue and promise helpers (Guilherme Araújo) #66631
worker:
  * (SEMVER-MINOR) preload streams into startup snapshot (Matteo Collina) #66311
zlib:
  * (SEMVER-MINOR) add crc32c (Philipp Dunkel) #66828

PR-URL: #67664
gabylb pushed a commit to gabylb/node that referenced this pull request Nov 27, 2026
@marcopiraccini @gabylb
child_process: add subprocess.timedOut
857608b
When the timeout option of spawn(), exec(), execFile() or fork()
expires, the child is sent the kill signal and exits with that signal.
Nothing told the caller that the timeout was the reason.

Set subprocess.timedOut to true when the kill signal is sent because of
the timeout, and add the same flag to the error passed to the exec()
and execFile() callback.

Fixes: nodejs#51561
Refs: nodejs#51608
Signed-off-by: marcopiraccini <[email protected]>
PR-URL: nodejs#66639
Reviewed-By: Paolo Insogna <[email protected]>
gabylb pushed a commit to gabylb/node that referenced this pull request Nov 27, 2026
@nodejs-github-bot @gabylb
2026-11-12, Version 27.0.0-alpha.0.1.0 (Alpha)
d26c0f2
Notable changes:

child_process:
  * (SEMVER-MINOR) add subprocess.timedOut (Marco) nodejs#66639
crypto:
  * (SEMVER-MINOR) make X.509 inspection guards explicit (Filip Skokan) nodejs#67245
  * (SEMVER-MINOR) add X.509 generation with CSR support (Filip Skokan) nodejs#67245
dns:
  * (SEMVER-MINOR) coalesce identical concurrent lookup() requests (Orgad Shaneh) nodejs#62599
doc:
  * add efekrskl to collaborators (Efe Karasakal) nodejs#67376
  * add Philipp Dunkel to contributors (Philipp Dunkel) nodejs#67378
  * add christianaurichzm to collaborators (Christian Aurich Zanettini Martins) nodejs#67377
http:
  * (SEMVER-MINOR) batch body spans per parser execute (Guilherme Araújo) nodejs#67187
sea:
  * (SEMVER-MINOR) generate a compile cache for the VFS modules (Matteo Collina) nodejs#66768
worker:
  * (SEMVER-MINOR) preload streams into startup snapshot (Matteo Collina) nodejs#66311

PR-URL: nodejs#67415
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ShogunPanda ShogunPanda ShogunPanda approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

child_process Issues and PRs related to the child_process subsystem. commit-queue-squash PRs the Commit Queue should land as one squashed commit. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Know when a process ended due to the child_process.spawn() timeout option

Uh oh!

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

5 participants

@marcopiraccini @inoway46 @nodejs-github-bot @ShogunPanda @panva
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 01402775 — 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.