From 5f3aa57210d111ac5beb949d88d356f071740760 Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Fri, 25 Jul 2025 10:22:26 -0300 Subject: [PATCH 1/4] benchmark: add --track to benchmark MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This option will measure how long the benchmark takes to run. Example: ``` $ ./node benchmark/run.js --track assert assert/assertion-error.js assert/assertion-error.js size=2 n=200: 22,987.24012781365 assert/assertion-error.js size=75 n=200: 296.2362823364434 [740ms] assert/assertion-error.js ... ``` Signed-off-by: RafaelGSS PR-URL: https://github.com/nodejs/node/pull/59174 Reviewed-By: Moshe Atlow Reviewed-By: Vinícius Lourenço Claro Cardoso --- benchmark/run.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/benchmark/run.js b/benchmark/run.js index ea0dc415e91ec6..4948292437fdde 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -3,6 +3,7 @@ const path = require('path'); const { spawn, fork } = require('node:child_process'); const CLI = require('./_cli.js'); +const { styleText } = require('node:util'); const cli = new CLI(`usage: ./node run.js [options] [--] ... Run each benchmark in the directory a single time, more than one @@ -16,6 +17,7 @@ const cli = new CLI(`usage: ./node run.js [options] [--] ... Default: 1 --set variable=value set benchmark variable (can be repeated) --format [simple|csv] optional value that specifies the output format + --track Display the time elapsed to run each benchmark file. test only run a single configuration from the options matrix all each benchmark category is run one after the other @@ -25,7 +27,7 @@ const cli = new CLI(`usage: ./node run.js [options] [--] ... --set CPUSET=0-2 Specifies that benchmarks should run on CPU cores 0 to 2. Note: The CPUSET format should match the specifications of the 'taskset' command on your system. -`, { arrayArgs: ['set', 'filter', 'exclude'] }); +`, { arrayArgs: ['set', 'filter', 'exclude'], boolArgs: ['track'] }); const benchmarks = cli.benchmarks(); @@ -107,7 +109,12 @@ async function run() { } while (runs-- > 0) { + const start = performance.now(); await runBenchmark(filename); + if (format !== 'csv' && cli.optional.track) { + const ms = styleText(['bold', 'yellow'], `${Math.round(performance.now() - start)}ms`); + console.log(`[${ms}] ${filename}`); + } } } } From ad07ae6ac2293fe5261c2150be0b55a82cb10b70 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Fri, 25 Jul 2025 16:54:55 +0200 Subject: [PATCH 2/4] test: remove timeout in test-https-proxy-request-handshake-failure The timeout is unnecessary since we are testing for certificate failure. It can cause flakes on very slow machines where the request cannot be finished in 1 second. PR-URL: https://github.com/nodejs/node/pull/59165 Fixes: https://github.com/nodejs/node/issues/59166 Reviewed-By: James M Snell Reviewed-By: Chemi Atlow Reviewed-By: Moshe Atlow Reviewed-By: Luigi Pinca --- test/client-proxy/test-https-proxy-request-handshake-failure.mjs | 1 - 1 file changed, 1 deletion(-) diff --git a/test/client-proxy/test-https-proxy-request-handshake-failure.mjs b/test/client-proxy/test-https-proxy-request-handshake-failure.mjs index df6bc446fee0e7..251d136afaa6c1 100644 --- a/test/client-proxy/test-https-proxy-request-handshake-failure.mjs +++ b/test/client-proxy/test-https-proxy-request-handshake-failure.mjs @@ -33,7 +33,6 @@ const requestUrl = `https://${serverHost}/test`; const { code, signal, stderr, stdout } = await runProxiedRequest({ NODE_USE_ENV_PROXY: 1, REQUEST_URL: requestUrl, - REQUEST_TIMEOUT: 1000, HTTPS_PROXY: `http://localhost:${proxy.address().port}`, }); From 7d6ce7765ca5cae13422fe8cbb82dff4dddd270d Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Fri, 25 Jul 2025 17:15:22 +0200 Subject: [PATCH 3/4] tools: clarify README linter error message PR-URL: https://github.com/nodejs/node/pull/59160 Reviewed-By: Antoine du Hamel Reviewed-By: Richard Lau --- tools/lint-readme-lists.mjs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/lint-readme-lists.mjs b/tools/lint-readme-lists.mjs index 97992b79b1e32e..6ad74d6edf72fa 100755 --- a/tools/lint-readme-lists.mjs +++ b/tools/lint-readme-lists.mjs @@ -6,7 +6,7 @@ import assert from 'node:assert'; import { open } from 'node:fs/promises'; import { argv } from 'node:process'; -const ghHandleLine = /^\* \[(.+)\]\(https:\/\/github\.com\/\1\) -$/; +const ghHandleLine = /^\* \[(.+)\]\(https:\/\/github\.com\/(.+)\) -$/; const memberInfoLine = /^ {2}\*\*[^*]+\*\* <<[^@]+@.+\.[a-z]+>>( \(\w+(\/[^)/]+)+\))?( - \[Support me\]\(.+\))?$/; const lists = { @@ -59,9 +59,11 @@ for await (const line of readme.readLines()) { ); } - if (!ghHandleLine.test(line)) { - throw new Error(`${currentGithubHandle} is not formatted correctly (README.md:${lineNumber})`); + const match = line.match(ghHandleLine); + if (!match) { + throw new Error(`${line} should match ${ghHandleLine} (README.md:${lineNumber})`); } + assert.strictEqual(match[1], match[2], `GitHub handle does not match the URL (README.md:${lineNumber})`); if ( currentList === 'TSC voting members' || From 345a550fa11bd02e5a7585d24b7021b3c2541594 Mon Sep 17 00:00:00 2001 From: theanarkh Date: Sat, 26 Jul 2025 02:15:22 +0800 Subject: [PATCH 4/4] src: call unmask after install signal handler PR-URL: https://github.com/nodejs/node/pull/59059 Reviewed-By: Anna Henningsen Reviewed-By: Benjamin Gruenbaum Reviewed-By: James M Snell --- src/inspector_agent.cc | 9 +++++---- src/node_watchdog.cc | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 202ed756c98d8a..87addfa8fbbaf3 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -123,12 +123,11 @@ static int StartDebugSignalHandler() { CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &savemask)); sigmask = savemask; pthread_t thread; - const int err = pthread_create(&thread, &attr, - StartIoThreadMain, nullptr); - // Restore original mask - CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr)); + const int err = pthread_create(&thread, &attr, StartIoThreadMain, nullptr); CHECK_EQ(0, pthread_attr_destroy(&attr)); if (err != 0) { + // Restore original mask + CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr)); fprintf(stderr, "node[%u]: pthread_create: %s\n", uv_os_getpid(), strerror(err)); fflush(stderr); @@ -137,6 +136,8 @@ static int StartDebugSignalHandler() { return -err; } RegisterSignalHandler(SIGUSR1, StartIoThreadWakeup); + // Restore original mask + CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr)); // Unblock SIGUSR1. A pending SIGUSR1 signal will now be delivered. sigemptyset(&sigmask); sigaddset(&sigmask, SIGUSR1); diff --git a/src/node_watchdog.cc b/src/node_watchdog.cc index 7a493bf460701f..3ea43177a4d75e 100644 --- a/src/node_watchdog.cc +++ b/src/node_watchdog.cc @@ -308,7 +308,10 @@ int SigintWatchdogHelper::Start() { CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &savemask)); sigmask = savemask; int ret = pthread_create(&thread_, nullptr, RunSigintWatchdog, nullptr); - CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr)); + + auto cleanup = OnScopeLeave( + [&]() { CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr)); }); + if (ret != 0) { return ret; }