diff --git a/benchmark/string_decoder/string-decoder.js b/benchmark/string_decoder/string-decoder.js index 8acb9c15bfd6f3..bcb4eace71b3ae 100644 --- a/benchmark/string_decoder/string-decoder.js +++ b/benchmark/string_decoder/string-decoder.js @@ -1,11 +1,12 @@ 'use strict'; const common = require('../common.js'); const StringDecoder = require('string_decoder').StringDecoder; +const assert = require('node:assert'); const bench = common.createBenchmark(main, { encoding: ['ascii', 'utf8', 'base64-utf8', 'base64-ascii', 'utf16le'], - inLen: [32, 128, 1024, 4096], - chunkLen: [16, 64, 256, 1024], + inLen: [32, 128, 1024], + chunkLen: [16, 256, 1024], n: [25e5], }); @@ -75,10 +76,13 @@ function main({ encoding, inLen, chunkLen, n }) { const nChunks = chunks.length; + let avoidDeadCode; bench.start(); for (let i = 0; i < n; ++i) { + avoidDeadCode = ''; for (let j = 0; j < nChunks; ++j) - sd.write(chunks[j]); + avoidDeadCode += sd.write(chunks[j]); } bench.end(n); + assert.ok(avoidDeadCode); } 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; } 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' ||