Commit Graph
49647 Commits
Author SHA1 Message Date
James M Snell 3680b2496e stream: append to arrays with indexed stores in stream/iter hot paths
ArrayPrototypePush() is listed among the primordials with known
performance issues. Append with an indexed store instead where
stream/iter collects chunks or batches: batching sources in from() and
fromSync(), flattening transform output in pull() and pullSync(), the
batches of push() and of Readable sources, the output of the zlib/iter
transforms and the chunks collected by bytes() and similar consumers.
Like ArrayPrototypePush(), an indexed store is unaffected by changes to
Array.prototype.push and runs setters defined for indices on
Array.prototype.

bytes() is about 13% faster, pullSync() through a generator transform
and push() about 6%, and the other paths up to 4%.

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66504
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-25 18:00:50 +01:00
James M Snell f177d0f276 stream: use a RingBuffer for the stream/iter operation queue
The hand-written stream/iter iterators queue calls made while another
one is in progress, as async generators do. They were queued in an
array taken off the front with ArrayPrototypeShift(), which copies the
rest of the queue, so calling next() many times without waiting was
quadratic: 160,000 concurrent next() calls on a from() iterator took 7
seconds.

Use a RingBuffer, kept once created, of QueuedOperation objects. The
same case takes 330 ms.

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66504
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-25 18:00:49 +01:00
James M Snell b2b748b925 stream: use a RingBuffer for stream/iter broadcast pending reads
Reads requested from a broadcast() consumer while another one is
pending were queued in an array and taken off the front with
ArrayPrototypeShift(), which copies the rest of the queue. Settling
many of them was quadratic: ending the writer with 160,000 reads
pending took 22 seconds.

Use a RingBuffer, starting small since the queue is rarely used. The
same case takes 56 ms. A new test covers the order in which several
pending reads are settled.

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66504
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-25 18:00:49 +01:00
James M Snell 9c6caaf0da stream: use a RingBuffer for stream/iter merge()'s ready queue
merge() queued every batch from its sources in an array, taking each
off the front with ArrayPrototypeShift(), which copies the rest of the
queue: up to one entry per source.

Use a RingBuffer. Merging async generators yielding 16-byte chunks,
one per batch, is about 6% faster with 2 sources, 9% with 8 and 36%
with 64.

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66504
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-25 18:00:49 +01:00
James M Snell 3eac066a5f stream: avoid quadratic batching in zlib/iter transforms
When the output collected by a zlib/iter transform exceeded a batch,
drainBatch() took buffers off the front of the pending array with
ArrayPrototypeShift(), which copies the rest of the array. The sync
transforms collect all output for an input chunk before draining it, so
a small input that decompresses to many buffers took quadratic time:
with a chunkSize of 1024, decompressing 128 MiB took 5.6 seconds,
growing four times when the output doubles.

Take each batch from the front with a single slice, advancing an index,
and clear the slots taken so that the buffers can be collected. The
batches are unchanged; decompressing 128 MiB as above takes 151 ms.

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66504
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-25 18:00:49 +01:00
James M Snell 5df8e3ab1d stream: remove async generator layers from stream/iter pull()
pull() read its pipeline through an async generator delegating to it
with yield*, and without transforms the pipeline was another such
generator around the source, each costing several promises per batch.

The pipelines already start lazily and queue calls as an async
generator does, so use the pipeline directly, and write the pipeline
without transforms out by hand: it checks the signal on the first
next(), then passes every call to the iterator reading the source.
Results are now IterResult objects, like those of the other stream/iter
iterators; one test compared them as ordinary objects.

With an async generator yielding 16-byte chunks, one per batch, pull()
is about 42% faster without transforms and 30% faster with a signal,
and about 12% faster through a transform.

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66504
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-25 18:00:49 +01:00
James M Snell 7d8f93f278 stream: read stream/iter sources with one abort listener
To read a source until a signal aborts, yieldAbortable() used an async
generator calling abortableNext() for every value, which added an abort
listener, raced the value against the abort with SafePromiseRace() and
removed the listener again with SafePromisePrototypeFinally(). This
made pull(), which always reads through its own signal, and pipeTo()
and the consumers with a signal about four times slower than without
one.

Write the generator out by hand with a single abort listener for the
whole iteration, held weakly so that the signal does not keep the
iterator alive, and wait for each value with a single promise that an
abort rejects. Aborts before, while and after reading a value, closing
the source on errors and aborts, and return() and throw() behave as
before.

With an async generator yielding 16-byte chunks, one per batch, pull()
is about 3.6x faster with or without a transform, pipeTo() with a
signal and a transform about 3.4x, and bytes() and array() with a
signal about 4.4x; pull() allocates about 7 KB less per chunk.

New tests cover an abort while the source is producing a value and the
removal of the listener.

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66504
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-25 18:00:49 +01:00
James M Snell dee87d4d42 stream: run stream/iter transforms without async generators
pipeTo() and pull() ran a pipeline of transforms through two async
generator layers for every batch: one applying each run of stateless
transforms, and the pipeline itself, which checks for an abort before
passing each batch on and cleans up when done. Each costs several
promises and an async frame per batch.

Write both out by hand, behaving the same way: the source is opened by
the first next(), calls made while one is in progress are queued, an
error from the source ends the pipeline without closing it, an error
from a transform closes it, return() and throw() close what is being
read, and the transforms' signal is aborted when the pipeline fails or
is stopped early. Transforms returning batches or chunks synchronously
take a single promise per batch for each layer; results that have to be
waited for or normalized asynchronously, the flush, and stateful
transforms are still handled by async generators.

With an async generator yielding 16-byte chunks, one per batch,
pipeTo() through one or two stateless transforms allocates about 900
bytes less per chunk and is about 38% faster.

The queue of operations for these iterators moves to utils.js. New
tests cover closing the source and aborting the transforms' signal.

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66504
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-25 18:00:49 +01:00
James M Snell 2a0aedf7fc stream: normalize sync sources without an async generator in from()
from() normalized a sync iterable source with an async generator, which
costs several promises and an async frame for every batch, even though
the source is read synchronously.

Read the source with a sync generator instead, which collects chunks
into batches as before, and normalize the values that need it, such as
promises, in an async iterator written out by hand around it. The sync
generator's for...of reads and closes the source as before: return()
and throw() are passed to it, after closing the value being normalized,
and an error normalizing a value is thrown into it, closing the source
as for an error in the loop body. As an async generator does, the
iterator stays busy until the tick after a result, so that calls made
synchronously after one are queued behind it.

With 16-byte chunks, one per batch, this allocates about 150 bytes less
per chunk; iterating from() is about 15% faster and pipeTo() about 11%
faster. Sources of single chunks, which are batched, are unchanged.

The queue of operations is now shared with the iterator for async
sources, and uses ArrayPrototypeShift(). New tests cover batching,
errors, closing and queuing for sync sources.

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66504
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-25 18:00:49 +01:00
James M Snell 391ad80583 stream: normalize async sources without a generator in from()
from() normalized an async iterable source with an async generator
looping over it with for await, which costs several promises and an
async frame for every batch.

Replace it with an iterator written out by hand that behaves the same
way: nothing happens until the first next(), calls made while one is in
progress are queued, an error from the source ends the iteration
without closing the source, an error normalizing a value closes the
source first, return() closes the value being normalized and the source
and propagates errors from closing them, and throw() closes them
ignoring such errors. Values that are already Uint8Array[] batches or
Uint8Arrays take one promise per batch; any other value is normalized
by an async generator as before. Sync iterable sources are unchanged.

With an async generator yielding 16-byte chunks, this allocates about
440 bytes less per chunk; pipeTo() is about 28% faster and iterating
from() about 38% faster.

The results of the iterator are now IterResult objects, like those of
the other stream/iter iterators, rather than ordinary objects; one
test compared them as such. New tests cover the behavior above.

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66504
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-25 18:00:49 +01:00
James M Snell b56d4b89bf stream: wait without an async function in stream/iter from()
The iterator through which from() reads an async source, to stay
cancellable while the source is pending, had an async next() that
awaited waitForNormalization() for every value: an async function
frame and promise, plus another promise and reactions for the wait.

Make next() a plain function that waits for the source's result with a
single promise, which a cancellation rejects directly. The result
checks, the closing of the source on cancellation and the precedence
between the source's result and a cancellation are unchanged.

With an async generator yielding 16-byte chunks, this allocates about
450 bytes less per chunk; pipeTo() is about 9% faster and iterating
from() about 11% faster.

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66504
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-25 18:00:48 +01:00
James M Snell 32c3d1ecde stream: avoid batch entries for single-chunk pipeTo() writes
pipeTo() and pipeToSync() created a batch entry for every batch, with
an array and a seven-field snapshot per chunk, to reject a chunk that
is resized or detached after being accepted. For the common
single-chunk batch, check the view around writeSync() with the
snapshot kept in locals instead, and create a batch entry in pipeTo()
only to fall back to write(). Views on SharedArrayBuffers and batches
of more chunks are still snapshotted as before, since writing one chunk
can change another.

With 16-byte chunks, one per batch, this saves about 100-175 bytes of
allocation per chunk: pipeTo() from a sync source is about 17% faster,
pipeToSync() about 15% faster and pipeTo() from an async generator
about 7% faster.

A new test covers detaching, resizing and growing a shared view in
writeSync() for both, and the fallback to write().

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66504
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-25 18:00:48 +01:00
James M Snell 99d7810a2e stream: yield bounded batches directly in stream/iter from()
When a source value is already a Uint8Array[] batch, from() and
fromSync() yielded it through `yield* yieldBoundedBatch(value)`, which
creates a generator for every batch only to split batches larger than
128 chunks. In the async normalization, yield* of a sync generator
also costs several extra promise ticks per batch.

Yield batches within the bound directly, and delegate to
yieldBoundedBatch() only for larger ones. Empty batches are still
skipped.

With 16-byte chunks, one per batch: pipeTo() from a sync iterable is
about 2x faster and iterating from() over it about 2.8x faster; from an
async generator, pipeTo() is about 1.5x and iteration about 1.7x
faster; pipeToSync() is about 1.4x faster.

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66504
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-11-25 18:00:48 +01:00
JuHyeong424 399ffad09a tls: fix abort on negative zero sessionTimeout
validateInt32() accepts -0, but the binding asserts IsInt32(),
which V8 reports as false for -0, so the process aborts. Coerce
the value to +0 before passing it to setSessionTimeout().

Signed-off-by: JuHyeong424 <wkdwngud963@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67661
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
2026-11-25 18:00:48 +01:00
Guilherme Araújo b3c63d1c66 sqlite: bind empty ArrayBuffer as empty blob
A zero-length ArrayBuffer or SharedArrayBuffer can have a null data
pointer, and SQLite treats a null blob pointer as NULL. As a result,
such values were bound as parameters, and returned from user-defined
functions, as NULL instead of an empty blob.

Use sqlite3_bind_zeroblob() and sqlite3_result_zeroblob() for empty
buffers.

Fixes: https://github.com/nodejs/node/issues/67188
Refs: https://github.com/nodejs/node/pull/62061
Assisted-by: Claude Opus 5.5
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67657
Reviewed-By: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-25 18:00:48 +01:00
Christian Aurich Zanettini Martins 76aaaca9e6 sqlite: mark as stable
Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67654
Fixes: https://github.com/nodejs/node/issues/57445
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Guilherme Araújo <arauujogui@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
2026-11-25 18:00:48 +01:00
Aayush 447123da9c url: keep the next '=' across pairs in parseParams
parseParams searched for '=' from the start of every pair. In a run of
pairs with no '=' after them, each search scanned to the end of the
string, so new URLSearchParams('a&'.repeat(n)) took quadratic time:
about 1.6 s for 262,144 pairs against 7.5 ms for 'a=b&'. Request's
formData() reaches the same loop with an urlencoded body.

Keep the position of the next '=' and search again only once the
parser has passed it.

Fixes: https://github.com/nodejs/node/issues/67652
Refs: https://github.com/nodejs/node/pull/65363
Signed-off-by: Aayush <21987529+aayushbtw@users.noreply.github.com>
PR-URL: https://github.com/nodejs/node/pull/67653
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-11-25 18:00:48 +01:00
Paolo Insogna 7c0e2202e6 tls: fix newSession after destroy and OCSP cert
The callback of the `newSession` event only checked that the handle was
still set. If a TLS error destroyed the socket while the callback was
pending, calling it afterwards still completed the handshake and
emitted `'secure'` and `'secureConnection'` on the destroyed socket.
Return early from it if the socket is already destroyed.

The callbacks of `OCSPRequest`, `SNICallback` and `resumeSession` do not
need the same check: the handshake does not read while they are
pending, so a TLS error cannot destroy the socket in the meantime, and
if the socket is closed some other way the existing `_handle` checks
already cover it.

Also, when the `SNICallback` returns a context that has no certificate,
for example one that only provides CAs, the handshake uses the
certificate of the server. The `OCSPRequest` event was still emitted
with the certificate and the issuer of that context, which are both
`null`. Use the context of the server in that case, so that the event
reports the certificate that is actually in use.

Assisted-By: OpenAI GPT-5.6 Sol <openai/gpt-5.6-sol>
Signed-off-by: Paolo Insogna <paolo@cowtech.it>
PR-URL: https://github.com/nodejs/node/pull/67650
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-25 18:00:48 +01:00
Fatih Güzel b4cad3fa68 net: validate onread buffers before each read
an onread buffer can be detached after registration while native code
still holds its address. validate the current view before each read
and report an error instead of writing into the former backing store.

Fixes: https://github.com/nodejs/node/issues/67397
Signed-off-by: Fatih Güzel <fatihguzeldev@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67407
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-25 18:00:48 +01:00
Renegade334 0f90fad89a test: update Intl tests for CLDR 49
* Accept prepended apostrophe to 2-digit year output
  (https://unicode-org.atlassian.net/browse/CLDR-19384)
* Avoid British/Irish metazone, as its behavior has changed
  (https://unicode-org.atlassian.net/browse/CLDR-19382)

Signed-off-by: Renegade334 <rene@renegade334.me.uk>
PR-URL: https://github.com/nodejs/node/pull/66992
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
2026-11-25 18:00:47 +01:00
Yuya Inoue 7be76dfe30 test: allow change events in fs watcher ref/unref test
The test checks watcher reference handling and process exit, not the
absence of filesystem events. Do not fail on incidental change events.

Signed-off-by: inoway46 <inoueyuya416@gmail.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/67644
Reviewed-By: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-11-25 18:00:47 +01:00
Minho Yoo 92dc5634af tools: disallow constructing an Error without using it
Add a no-restricted-syntax selector next to the existing
ThrowStatement one. It would have caught the benchmark bug fixed in
the previous commit; the two intentional sites are disabled inline.

Assisted-by: a closed-source coding agent
Signed-off-by: Minho Yoo <13810291+irontaek@users.noreply.github.com>
PR-URL: https://github.com/nodejs/node/pull/66647
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-11-25 18:00:47 +01:00
Minho Yoo 946d034060 benchmark: throw on invalid type in fs and webstorage
The default branch of the type switch constructed an Error without
throwing it, so an unknown type silently benchmarked an undefined
path instead of failing.

Assisted-by: a closed-source coding agent
Signed-off-by: Minho Yoo <13810291+irontaek@users.noreply.github.com>
PR-URL: https://github.com/nodejs/node/pull/66647
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-11-25 18:00:47 +01:00
Livia Medeiros d994210337 lib: legitimize SuppressedError as primordial
Signed-off-by: LiviaMedeiros <livia@cirno.name>
PR-URL: https://github.com/nodejs/node/pull/67551
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-25 18:00:47 +01:00
Yagiz Nizipli 2a90c852bd test: update WPT for url to 2fa965b55c
Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
Assisted-by: Grok
PR-URL: https://github.com/nodejs/node/pull/67624
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Daniel Lemire <daniel@lemire.me>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2026-11-25 18:00:47 +01:00
Node.js GitHub Bot 1807e26af2 deps: update ada to 4.1.1
PR-URL: https://github.com/nodejs/node/pull/67624
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Daniel Lemire <daniel@lemire.me>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2026-11-25 18:00:47 +01:00
Matteo Collina 0c495c86d5 stream: stop reusing a detached onread buffer
CustomBufferJSListener keeps only the raw address (uv_buf_t) of the
user-supplied onread buffer, without retaining the backing store. If
application code transfers (and thereby detaches) that buffer during the
onread callback, for example by enqueuing a view into a byte
ReadableStream, the backing store is moved away from under the listener
and the raw address is left dangling. Reading subsequent peer data into
that address then corrupts memory the application owns, and if the
backing store is later released, it becomes a use-after-free.

Retain the backing store in CustomBufferJSListener so the raw address
never dangles, and stop reading when the onread callback detaches the
buffer so the stale address is not handed back to libuv.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/67542
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2026-11-25 18:00:47 +01:00
jakecastelliandMikhail Leliakin bdd02b128c http2: add missing setHeaders
Make it possible to invoke response.setHeaders() on the
Http2ServerResponse object, matching the http.OutgoingMessage API.

Fixes: https://github.com/nodejs/node/issues/51573
Refs: https://github.com/nodejs/node/pull/51576
Signed-off-by: jakecastelli <38635403+jakecastelli@users.noreply.github.com>
Signed-off-by: Mikhail Leliakin <leliakin@canva.com>
Co-authored-by: Mikhail Leliakin <leliakin@canva.com>
Assisted-by: Cursor
PR-URL: https://github.com/nodejs/node/pull/67597
Reviewed-By: Jason Zhang <xzha4350@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-25 18:00:47 +01:00
LiviaMedeiros cd0f8977e5 diagnostics_channel: use DisposableStack primordial
Signed-off-by: LiviaMedeiros <livia@cirno.name>
PR-URL: https://github.com/nodejs/node/pull/67533
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-25 18:00:46 +01:00
LiviaMedeiros 96e44a8176 Revert "diagnostics_channel: replace using with try-finally"
This reverts commit b1251217f2.

Signed-off-by: LiviaMedeiros <livia@cirno.name>
PR-URL: https://github.com/nodejs/node/pull/67533
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-25 18:00:46 +01:00
LiviaMedeiros 5ade0dbac0 lib: add ERM classes to primordials
Totes three classes:
- `DisposableStack`
- `AsyncDisposableStack`
- `SuppressedError`

Signed-off-by: LiviaMedeiros <livia@cirno.name>
PR-URL: https://github.com/nodejs/node/pull/67533
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-25 18:00:46 +01:00
Filip Skokan 6fe632a65b test: use FIPS-compatible PBKDF2 inputs
Fixes: https://github.com/nodejs/node/issues/67673
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67675
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
2026-11-25 18:00:46 +01:00
Matteo Collina 1b2ee6fc2f test: limit concurrency in gc-http-client tests
The tests started one request chain per CPU, each issuing a new request
on every event loop turn until the first response arrived. On a loaded
macOS host this put more than 128 connections in flight, overflowing
the listen queue. The kernel then drops an incomplete connection and
answers its final ACK with a RST, so the client fails with
`connect ECONNRESET`.

Use a fixed number of concurrent requests and a fixed total instead.

Drive-by: the error handler in test-gc-http-client-onerror rethrows,
fix the comment that says it does nothing.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/67607
Refs: https://github.com/nodejs/node/issues/41399
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
2026-11-25 18:00:46 +01:00
Matteo Collina f99cbb36ea esm: avoid dictionary-mode objects in import()
Import attributes were created in C++ with v8::Object::New() and a
null prototype, once per module request and once per import() call.
Every import() call also created a `{ __proto__: null }`
diagnostics_channel context, which was discarded when module.import
had no subscribers. V8 creates all of these in dictionary mode.

Build the attributes from an ordinary object with its prototype set to
null, and only create the trace context when there are subscribers.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/67554
Refs: https://github.com/nodejs/node/pull/67552
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-25 18:00:46 +01:00
Max Fisher 67b9232258 repl: redraw highlighted input once per chunk
Signed-off-by: Max H Fisher <mfisher187@bloomberg.net>
PR-URL: https://github.com/nodejs/node/pull/67422
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2026-11-25 18:00:46 +01:00
Ethan Arrowood f78fb48b39 doc,test: clarify http1 insecure validation
The httpValidation docs said 'insecure' disables all header value
validation. That wasn't entirely true. It only did so for incomming
messages (which are parsed with all --insecure-http-parser leniency
flags). Outgoing header values are still validaed as in 'relaxed'
mode. This comes from the design in https://github.com/nodejs/node/pull/61597

This change corrects the docs and adds some tests to assert the
expected behavior

Refs: https://github.com/nodejs/node/pull/61597
Refs: https://github.com/nodejs/node/pull/63571
Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ethan Arrowood <ethan@arrowood.dev>
PR-URL: https://github.com/nodejs/node/pull/67560
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-25 18:00:46 +01:00
Manzoor Wani 78f26c3cb8 src: fix hang when joining workers in process.exit()
V8 background jobs, such as concurrent Sparkplug and Maglev compiles,
can run into the heap limit. They then post a GC request to the main
thread and park in CollectionBarrier::AwaitCollectionBackground()
until the main thread collects garbage or the isolate is torn down.

process.exit() does neither. DefaultProcessExitHandlerInternal()
calls DisposePlatform() while the isolate is still alive and not
running JS, and NodePlatform::Shutdown() joins the worker threads.
A worker that is parked at that point never wakes up, and the join
hangs forever.

Pass the exiting isolate down to NodePlatform::Shutdown(). While the
workers finish their current tasks, the main thread checks every
10ms whether a foreground task was posted for that isolate. If so,
it drops the queued tasks, which would never run on this path, and
performs a GC so that the parked workers can finish. Normal exits
dispose the isolate before the platform and are not affected.

Fixes: https://github.com/nodejs/node/issues/64274
Signed-off-by: Manzoor Wani <manzoorwani.jk@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66171
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-25 18:00:46 +01:00
Rafael Gonzaga d25a7d3356 fs: do not disable fd-based APIs in permission audit mode
Refs: https://github.com/nodejs/node/pull/65659
Refs: https://github.com/nodejs/node/issues/65419
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
PR-URL: https://github.com/nodejs/node/pull/66726
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
2026-11-25 18:00:45 +01:00
Rafael Gonzaga 0b16743f5a permission: drop fs grants regardless of the path's current type
Revoking a grant re-checked whether the path is a directory, so a path
that changed type after startup no longer matched the stored grant and
the drop was a silent no-op. Match both the plain and the wildcard form.

Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
PR-URL: https://github.com/nodejs/node/pull/66766
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
2026-11-25 18:00:45 +01:00
James M Snell d3672ac98c lib: avoid using __proto__: null in AbortController/AbortSignal
Using `__proto__: null` on objects will properties immediately
puts them into the slower DictionaryProperties mode. Using a
`__proto__: { __proto: null }, ...` pattern, however, keeps
the objects in FastProperties mode.

Technically this is an observable change since calling
`Object.getPrototoTypeOf(...)` some of these will no longer
return `null`. So a decision needs to be made about whether
these types of changes are `semver-major` or not.

Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66678
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2026-11-25 18:00:45 +01:00
Christian Aurich Zanettini Martins 3eeb9665e7 meta: add christianaurichzm to .mailmap
Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67625
Refs: https://github.com/nodejs/node/pull/67622
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Beth Griggs <bethanyngriggs@gmail.com>
2026-11-25 18:00:45 +01:00
npm CLI robot 5fbaaa2303 deps: upgrade npm to 12.2.3
PR-URL: https://github.com/nodejs/node/pull/67584
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Mike McCready <66998419+MikeMcC399@users.noreply.github.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-11-25 18:00:45 +01:00
Shelley Vohr ada6a05651 module: disable the compile cache while V8 coverage is collected
V8 cannot collect block coverage for functions that are deserialized
from the code cache, so it only reports how many times each of them
ran. With a warm compile cache, branches that never ran inside those
functions are reported as covered, and tools that merge reports from
several processes can report functions that ran as never run.

The documentation recommended turning the cache off by hand. Do it
automatically when coverage collection starts with the process, through
NODE_V8_COVERAGE or --experimental-test-coverage.

The compile cache tests stop propagating NODE_V8_COVERAGE to the
processes they spawn, so that they keep working when the test suite
itself runs with coverage.

Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67120
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-11-25 18:00:45 +01:00
Aviv Keller 51d31c0373 test_runner: junit fixes
Signed-off-by: avivkeller <me@aviv.sh>
PR-URL: https://github.com/nodejs/node/pull/67160
Fixes: https://github.com/nodejs/node/issues/67155
Fixes: https://github.com/nodejs/node/issues/67149
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-25 18:00:45 +01:00
René b7bcf0f413 fs: use try...finally for abort race
Signed-off-by: Renegade334 <rene@renegade334.me.uk>
PR-URL: https://github.com/nodejs/node/pull/67545
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-25 18:00:45 +01:00
Fatih Güzel 2827766e32 meta: add Fatih Güzel to .mailmap
Signed-off-by: Fatih Güzel <fatihguzeldev@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67622
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
2026-11-25 18:00:44 +01:00
Efe Karasakal f247d55673 quic: honor enableEarlyData on servers
Signed-off-by: Efe Karasakal <hi@efe.dev>
PR-URL: https://github.com/nodejs/node/pull/67562
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-11-25 18:00:44 +01:00
Paolo Insogna 48e8b86625 worker: add diagnostic channel 'worker_threads.main.registry'
Signed-off-by: Paolo Insogna <paolo@cowtech.it>
Assisted-By: OpenAI:GPT-6.1 Sol <openai/gpt-6.1-sol>
PR-URL: https://github.com/nodejs/node/pull/67311
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-11-25 18:00:44 +01:00
Livia Medeiros 9617c4a553 test: restrict os.tmpdir() in favour of common/tmpdir
Signed-off-by: LiviaMedeiros <livia@cirno.name>
PR-URL: https://github.com/nodejs/node/pull/67567
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-11-25 18:00:44 +01:00
Filip Skokan 25196c876d doc: clarify crypto and Web Crypto options
Document which digest and MAC options apply and how output lengths
work. Clarify signature contexts and distinguish required parameters
from optional defaults in Web Crypto.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/67565
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2026-11-25 18:00:44 +01:00