From 8c62c35cfdbc10e40592006a51200f8d28f9a8dc Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Fri, 25 Sep 2026 21:42:28 +0000 Subject: [PATCH] report: skip unresponsive workers on process timeout When --process-timeout expires, --report-on-process-timeout asked every Worker for a subreport and waited without a time limit. A Worker blocked in a synchronous native call never answers, so the watchdog force-exited the process before the report was written. That left a truncated, invalid JSON file, and the forced-exit message was glued onto the "Writing Node.js report to file" line. For reports triggered by --process-timeout, wait at most two seconds for Worker subreports and leave out Worker threads that have not responded by then. The subreport state is now shared with the interrupt callbacks, so a Worker that answers late does not touch freed memory. Other report triggers are unchanged. Signed-off-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Assisted-by: claude:opus-5.5 --- doc/api/cli.md | 4 ++ doc/node.1 | 3 ++ src/node_mutex.h | 14 ++++++ src/node_report.cc | 57 +++++++++++++++------- src/node_watchdog.cc | 5 +- src/node_watchdog.h | 8 +++ test/report/test-report-process-timeout.js | 47 ++++++++++++++++++ 7 files changed, 116 insertions(+), 22 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index cafc7ed2e4b..ac8c1161ee8 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -2840,6 +2840,10 @@ addition to the summary printed to stderr. Useful to inspect the JavaScript and native stacks, the event loop state, and resource consumption to reason about why the process did not exit. Requires [`--process-timeout`][]. +Worker threads that do not provide their part of the report within two +seconds, for example because they are blocked in a synchronous operation such +as [`child_process.execSync()`][], are left out of it. + ### `--report-on-signal`