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 — src: expand --process-timeout output to include workers by jasnell · Pull Request #67712 · nodejs/node

src: expand --process-timeout output to include workers #67712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
nodejs-github-bot merged 1 commit into nodejs:main from jasnell:jasnell/process-timeout-worker-details
Nov 25, 2026

Uh oh!

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

Merged

src: expand --process-timeout output to include workers #67712

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1 commit
Select commit
6740446
src: expand --process-timeout output to include workers
jasnell Nov 22, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

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

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

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

Diff view
Diff view

There are no files selected for viewing

48 changes: 47 additions & 1 deletion 48 doc/api/cli.md
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2716,6 +2716,48 @@ changes:

Identical to `-e` but prints the result.

### `--process-timeout-worker-stacks`

<!-- YAML
added: REPLACEME
-->

> Stability: 1.1 - Active development
When [`--process-timeout`][] expires, also prints what each [`Worker`][] thread,
including Workers created by other Workers, was doing and which resources were
keeping its event loop alive to stderr, after the summary for the main thread:

```console
$ node --process-timeout=5s --process-timeout-worker-stacks app.js
(node:25418) Process timed out after 5s (--process-timeout). Exiting with code 124.
Main thread was not executing JavaScript.
Resources keeping the event loop alive:
Worker (thread 2, name 'WorkerThread')
Worker (thread 1, name 'compute')
Worker thread 1 (name 'compute') was executing JavaScript:
at spin (/home/user/compute.js:3:3)
at /home/user/compute.js:6:1
at node:internal/modules/cjs/loader:1989:14
at node:internal/modules/cjs/loader:2129:10
at node:internal/modules/cjs/loader:1711:32
at node:internal/modules/cjs/loader:1501:12
at wrapModuleLoad (node:internal/modules/cjs/loader:261:19)
at executeUserEntryPoint (node:internal/modules/run_main:166:5)
at node:internal/main/worker_thread:247:26
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:876:20)
No resources keeping its event loop alive were found.
Worker thread 2 (name 'WorkerThread') was not executing JavaScript.
Resources keeping its event loop alive:
Timeout (next due in 28ms)
```

Worker threads that do not respond within two seconds, for example because
they are blocked in a synchronous operation such as
[`child_process.execSync()`][], are listed without a stack trace or
resources. Requires
[`--process-timeout`][].

### `--process-timeout=duration`

<!-- YAML
Expand Down Expand Up @@ -2746,7 +2788,9 @@ Resources keeping the event loop alive:
```

If the main thread was executing JavaScript, its stack trace is printed instead.
Use [`--report-on-process-timeout`][] to also generate a [diagnostic report][].
Use [`--process-timeout-worker-stacks`][] to also print the stack traces of
Worker threads, and [`--report-on-process-timeout`][] to also generate a
[diagnostic report][].

The process exits without emitting the `'beforeExit'` and `'exit'` events, as
the JavaScript code may be what keeps the process running. Code coverage and
Expand Down Expand Up @@ -4975,6 +5019,7 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
[`--openssl-config`]: #--openssl-configfile
[`--preserve-symlinks`]: #--preserve-symlinks
[`--print`]: #-p---print-script
[`--process-timeout-worker-stacks`]: #--process-timeout-worker-stacks
[`--process-timeout`]: #--process-timeoutduration
[`--redirect-warnings`]: #--redirect-warningsfile
[`--report-on-process-timeout`]: #--report-on-process-timeout
Expand All @@ -4995,6 +5040,7 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
[`NO_COLOR`]: https://no-color.org
[`RealFSProvider`]: vfs.md#class-realfsprovider
[`Web Storage`]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API
[`Worker`]: worker_threads.md#class-worker
[`YoungGenerationSizeFromSemiSpaceSize`]: https://chromium.googlesource.com/v8/v8.git/+/refs/tags/10.3.129/src/heap/heap.cc#328
[`ZipProvider`]: vfs.md#class-zipprovider
[`child_process.execSync()`]: child_process.md#child_processexecsynccommand-options
Expand Down
37 changes: 36 additions & 1 deletion 37 doc/node.1
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,39 @@ See \fB--preserve-symlinks\fR for more information.
.It Fl p , Fl -print Ar "script"
Identical to \fB-e\fR but prints the result.
.
.It Fl -process-timeout-worker-stacks
When \fB--process-timeout\fR expires, also prints what each \fBWorker\fR thread,
including Workers created by other Workers, was doing and which resources were
keeping its event loop alive to stderr, after the summary for the main thread:
.Bd -literal
$ node --process-timeout=5s --process-timeout-worker-stacks app.js
(node:25418) Process timed out after 5s (--process-timeout). Exiting with code 124.
Main thread was not executing JavaScript.
Resources keeping the event loop alive:
Worker (thread 2, name 'WorkerThread')
Worker (thread 1, name 'compute')
Worker thread 1 (name 'compute') was executing JavaScript:
at spin (/home/user/compute.js:3:3)
at /home/user/compute.js:6:1
at node:internal/modules/cjs/loader:1989:14
at node:internal/modules/cjs/loader:2129:10
at node:internal/modules/cjs/loader:1711:32
at node:internal/modules/cjs/loader:1501:12
at wrapModuleLoad (node:internal/modules/cjs/loader:261:19)
at executeUserEntryPoint (node:internal/modules/run_main:166:5)
at node:internal/main/worker_thread:247:26
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:876:20)
No resources keeping its event loop alive were found.
Worker thread 2 (name 'WorkerThread') was not executing JavaScript.
Resources keeping its event loop alive:
Timeout (next due in 28ms)
.Ed
Worker threads that do not respond within two seconds, for example because
they are blocked in a synchronous operation such as
\fBchild_process.execSync()\fR, are listed without a stack trace or
resources. Requires
\fB--process-timeout\fR.
.
.It Fl -process-timeout Ns = Ns Ar duration
Exits the process with code \fB124\fR if it is still running after \fBduration\fR,
measured from the start of the process. \fBduration\fR is a positive integer
Expand All @@ -1431,7 +1464,9 @@ Resources keeping the event loop alive:
Timeout x2 (next due in 2931ms)
.Ed
If the main thread was executing JavaScript, its stack trace is printed instead.
Use \fB--report-on-process-timeout\fR to also generate a diagnostic report.
Use \fB--process-timeout-worker-stacks\fR to also print the stack traces of
Worker threads, and \fB--report-on-process-timeout\fR to also generate a
diagnostic report.
The process exits without emitting the \fB'beforeExit'\fR and \fB'exit'\fR events, as
the JavaScript code may be what keeps the process running. Code coverage and
profiles, such as those enabled with \fBNODE_V8_COVERAGE=dir\fR or
Expand Down
8 changes: 8 additions & 0 deletions 8 src/node_options.cc
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ void PerProcessOptions::CheckProcessTimeoutOptions(
errors->push_back(
"--report-on-process-timeout must be used with --process-timeout");
}
if (process_timeout_worker_stacks) {
errors->push_back("--process-timeout-worker-stacks must be used with "
"--process-timeout");
}
return;
}

Expand Down Expand Up @@ -1823,6 +1827,10 @@ PerProcessOptionsParser::PerProcessOptionsParser(
"print why the process is still running and exit with code 124 "
"if it has not exited after the given duration (e.g. 30s)",
&PerProcessOptions::process_timeout);
AddOption("--process-timeout-worker-stacks",
"also print the JavaScript stacks of Worker threads when "
"--process-timeout expires",
BOOL_FIELD(process_timeout_worker_stacks));

Insert(iop, &PerProcessOptions::get_per_isolate_options);

Expand Down
1 change: 1 addition & 0 deletions 1 src/node_options.h
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ class PerProcessOptions : public Options {
DEFINE_BOOL_FIELD(disable_wasm_trap_handler) = false;
DEFINE_BOOL_FIELD(report_on_fatalerror) = false;
DEFINE_BOOL_FIELD(report_on_process_timeout) = false;
DEFINE_BOOL_FIELD(process_timeout_worker_stacks) = false;
DEFINE_BOOL_FIELD(report_compact) = false;
DEFINE_BOOL_FIELD(trace_sigint) = false;
// Tracks whether `--run` was passed, since an empty `run` is ambiguous
Expand Down
Loading
Oops, something went wrong.

Uh oh!

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

Loading
Oops, something went wrong.

Uh oh!

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

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 01402792 — 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.