Commit Graph
11921 Commits
Author SHA1 Message Date
7ea06c192b crypto: fix unsigned conversion of 4-byte RSA publicExponent
`bigIntArrayToUnsignedInt` used the signed `<<` operator, so when the
most significant byte of a 4-byte input had its top bit set (e.g.
`[0x80, 0x00, 0x00, 0x01]`) the result was a negative Int32 instead of
the intended unsigned 32-bit value. This caused any RSA `publicExponent`
exactly 4 bytes long with the top bit set to be parsed incorrectly.
Coerce the final value with `>>> 0` and add a unit test.

Assisted-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: DeepView Autofix <276251120+deepview-autofix@users.noreply.github.com>
Co-Authored-By: Nikita Skovoroda <chalkerx@gmail.com>
Signed-off-by: Nikita Skovoroda <chalkerx@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62839
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-07-19 17:31:11 -05:00
Daijiro Wachi eaa817f243 lib: avoid quadratic shift() in startup snapshot callback
PR-URL: https://github.com/nodejs/node/pull/62914
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-07-19 17:31:11 -05:00
Gürgün Dayıoğlu a0b970af77 url: optimize URLSearchParams set/delete duplicate handling
PR-URL: https://github.com/nodejs/node/pull/62266
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Aviv Keller <me@aviv.sh>
2026-07-19 17:31:10 -05:00
Gürgün Dayıoğlu 75b0b18e61 process: handle rejections only when needed
Signed-off-by: Gürgün Dayıoğlu <hey@gurgun.day>
PR-URL: https://github.com/nodejs/node/pull/62919
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com>
2026-07-19 17:31:10 -05:00
Tim Perry 2ffb92bc35 http: fix leaked error listener on sync HTTP req create + destroy
Previously, this resulted in an error listener being added but not
cleaned up when the socket was freed back to the agent pool.

This also updates the docs to clarify when req.destroy() kills the
underlying socket - only if it's called during request processing (more
specifically: after onSocketNT, at which point we may have started
reading & writing).

Signed-off-by: Tim Perry <pimterry@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62872
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-07-19 17:31:09 -05:00
Filip Skokan e1df7f5615 lib: harden kKeyOps lookup with null prototype
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62877
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2026-07-19 17:31:09 -05:00
Daijiro Wachi d7d6fdbbb8 http: fix no_proxy leading-dot suffix matching
PR-URL: https://github.com/nodejs/node/pull/62333
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-07-19 17:31:09 -05:00
Antoine du Hamel e22786e470 module: remove duplicated checks from _resolveFilename
PR-URL: https://github.com/nodejs/node/pull/62729
Reviewed-By: Jacob Smith <jacob@frende.me>
2026-07-19 17:31:08 -05:00
Daijiro Wachi e32b026625 stream: ensuring cross-destruction in _duplexify to prevent leaks
PR-URL: https://github.com/nodejs/node/pull/62824
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
2026-07-19 17:31:07 -05:00
René 16db5927da lib: use js-only implementation of isDataView()
PR-URL: https://github.com/nodejs/node/pull/62780
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Xuguang Mei <meixuguang@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-07-19 17:31:06 -05:00
Ms2ger de8e6dca08 lib: fix sequence argument handling in Blob constructor
This uses the existing WebIDL infrastructure to handle the iteration
over the argument correctly according to the specification.

Note that we can't avoid looping over the input twice: we only know the
value of the 'endings' option after converting the blob parts into an
array.

PR-URL: https://github.com/nodejs/node/pull/62179
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: Jason Zhang <xzha4350@gmail.com>
2026-07-19 17:31:05 -05:00
Matteo Collina b86fb9073b stream: fix nested compose error propagation
PR-URL: https://github.com/nodejs/node/pull/62556
Fixes: https://github.com/nodejs/node/issues/60083
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-07-19 17:31:04 -05:00
Edy Silva 1878e7b675 fs: validate position argument before length === 0 early return
PR-URL: https://github.com/nodejs/node/pull/62674
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-07-19 17:31:04 -05:00
Antoine du Hamel f370889d1a stream: simplify createPromiseCallback
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62650
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-07-19 17:31:02 -05:00
sangwook 04e1e7efb7 stream: fix writev unhandled rejection in fromWeb
When using Duplex.fromWeb() or Writable.fromWeb() with cork()/uncork(),
writes are batched into _writev(). If destroy() is called in the same
microtask, the underlying WritableStream writer gets aborted, causing
SafePromiseAll() to reject with a non-array value (e.g. an AbortError).

The done() callback in _writev() of both fromWeb adapter functions
unconditionally called error.filter(), assuming the value was always an
array. This caused a TypeError that became an unhandled rejection,
crashing the process.

Fix by separating the resolve and reject handlers of SafePromiseAll:
use () => done() on the resolve path (all writes succeeded, no error)
and done on the reject path (error passed directly to callback).

Fixes: https://github.com/nodejs/node/issues/62199
Signed-off-by: sangwook <rewq5991@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62297
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
2026-07-19 17:31:02 -05:00
Ruben Bridgewater 90f90ae20e assert,util: fix stale nested cycle memo entries
Temporary nested cycle-tracking entries could remain in the memory set
after a successful comparison. If a later sibling comparison reused one
of those objects, deepStrictEqual could incorrectly fail for equivalent
structures.
This cleans up the temporary nested entries after the nested
comparison returns.

Fixes: https://github.com/nodejs/node/issues/62422
PR-URL: https://github.com/nodejs/node/pull/62509
Fixes: https://github.com/nodejs/node/issues/62422
Reviewed-By: Jordan Harband <ljharb@gmail.com>
2026-07-19 17:31:01 -05:00
Antoine du Hamel dae9644789 stream: refactor duplexify to be less suceptible to prototype pollution
PR-URL: https://github.com/nodejs/node/pull/62559
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
2026-07-19 17:31:01 -05:00
Robert Nagy b27b85fb3d http: cleanup pipeline queue
When a socket with pipelined requests is destroyed then some requests
will leak.

PR-URL: https://github.com/nodejs/node/pull/62534
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-07-19 17:30:58 -05:00
Gürgün Dayıoğlu df6e226943 process: optimize asyncHandledRejections by using FixedQueue
PR-URL: https://github.com/nodejs/node/pull/60854
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2026-07-19 17:30:56 -05:00
Gürgün Dayıoğlu 5dca770350 events: avoid cloning listeners array on every emit
PR-URL: https://github.com/nodejs/node/pull/62261
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2026-07-19 17:30:55 -05:00
Matteo Collina 7748f609c2 test_runner: make it compatible with fake timers
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/59272
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2026-07-19 17:30:53 -05:00
Filip Skokan b60f32f234 lib: make SubtleCrypto.supports enumerable
PR-URL: https://github.com/nodejs/node/pull/62307
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-07-19 17:30:52 -05:00
Marco 979e095bd4 module: fix coverage of mocked CJS modules imported from ESM
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62133
Fixes: https://github.com/nodejs/node/issues/61709
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2026-07-19 17:30:52 -05:00
Ali Hassan 289e747d5a stream: replace bind with arrow function for onwrite callback
PR-URL: https://github.com/nodejs/node/pull/62087
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2026-07-19 17:30:50 -05:00
Filip Skokan cd6941d391 crypto: read algorithm name property only once in normalizeAlgorithm
PR-URL: https://github.com/nodejs/node/pull/62170
Refs: https://redirect.github.com/web-platform-tests/wpt/pull/57614#pullrequestreview-3808145365
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2026-07-19 17:30:50 -05:00
Mattias Buelens cfeaa8730e stream: optimize webstreams pipeTo
PR-URL: https://github.com/nodejs/node/pull/62079
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-07-19 17:30:50 -05:00
Gerhard Stöbich a89339faf5 http: fix use-after-free when freeParser is called during llhttp_execute
When pipelined requests arrive in one TCP segment, llhttp_execute()
parses them all in a single call. If a synchronous 'close' event
handler invokes freeParser() mid-execution, cleanParser() nulls out
parser state while llhttp_execute() is still on the stack, crashing on
 the next callback.

Add an is_being_freed_ flag that freeParser() sets via
parser.markFreed() before cleaning state. Proxy::Raw checks the flag
before every callback and returns HPE_USER to abort execution early if
set.

PR-URL: https://github.com/nodejs/node/pull/62095
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2026-07-19 17:30:49 -05:00
Marco 2308c74ad9 stream: fix TransformStream race on cancel with pending write
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62040
Fixes: https://github.com/nodejs/node/issues/62036
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Mattias Buelens <mattias@buelens.com>
2026-07-19 17:30:48 -05:00
Matteo Collina 775ae50221 http: validate ClientRequest path on set
The `path` property on `ClientRequest` was only validated at
construction time. Add a getter/setter so that the same
`INVALID_PATH_REGEX` check runs whenever `req.path` is reassigned,
preventing invalid characters from reaching `_implicitHeader()`.

PR-URL: https://github.com/nodejs/node/pull/62030
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-07-19 17:30:47 -05:00
Richard Clarke 956d8db822 http: validate headers in writeEarlyHints
Add validateHeaderName/validateHeaderValue checks for non-link
headers and checkInvalidHeaderChar for the Link value in HTTP/1.1
writeEarlyHints, closing a CRLF injection gap where header names
and values were concatenated into the raw response without
validation.

Also tighten linkValueRegExp to reject CR/LF inside the <...>
URL portion of Link header values.

PR-URL: https://github.com/nodejs/node/pull/61897
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-07-19 17:30:47 -05:00
Mert Can Altin 8ec00f4711 buffer: optimize buffer.concat performance
PR-URL: https://github.com/nodejs/node/pull/61721
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2026-07-19 17:30:46 -05:00
Ms2ger 905489c17c lib: improve argument handling in Blob constructor
As specified in WebIDL (<https://webidl.spec.whatwg.org/#js-dictionary>),
the fields of a dictionary need to be read in lexicographical order.

PR-URL: https://github.com/nodejs/node/pull/61980
Reviewed-By: Jason Zhang <xzha4350@gmail.com>
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2026-07-19 17:30:46 -05:00
René 8be503223b inspector: unwrap internal/debugger/inspect imports
PR-URL: https://github.com/nodejs/node/pull/61974
Refs: https://github.com/nodejs/node/pull/38161
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-07-19 17:30:45 -05:00
Igor Shevelenkov 263129fb93 test_runner: run afterEach on runtime skip
Signed-off-by: Igor <igorshevelenkov4@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/61525
Fixes: https://github.com/nodejs/node/issues/61462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2026-07-19 17:30:45 -05:00
Matteo Collina 03f4121ebb stream: fix pipeTo to defer writes per WHATWG spec
The WHATWG Streams spec requires that pipeTo's chunk handling must
queue a microtask before calling the write algorithm. This ensures
that enqueue() does not synchronously trigger writes.

Previously, PipeToReadableStreamReadRequest[kChunk] would synchronously
call writableStreamDefaultWriterWrite(), which violated the spec and
caused the WPT test "enqueue() must not synchronously call write
algorithm" to fail.

Fix by wrapping the write operation in queueMicrotask(), which defers
it to the next microtask as required by the spec.

Refs: https://github.com/whatwg/streams/issues/1243
PR-URL: https://github.com/nodejs/node/pull/61800
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Mattias Buelens <mattias@buelens.com>
2026-07-19 17:30:45 -05:00
Marco afb7270785 child_process: add tracing channel for spawn
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/61836
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-07-19 17:30:45 -05:00
Ayoub Mabrouk 7d67940bca test_runner: replace native methods with primordials
Replace native methods with primordials.

PR-URL: https://github.com/nodejs/node/pull/61219
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2026-07-19 17:30:45 -05:00
Hiroki Osame 5d0a1b522f util: add fast path to stripVTControlCharacters
PR-URL: https://github.com/nodejs/node/pull/61833
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-07-19 17:30:45 -05:00
Matteo CollinaandMalte Ubl 8f8bcb2b0a stream: add fast paths for webstreams read and pipeTo
Add internal fast paths to improve webstreams performance without
changing the public API or breaking spec compliance.

1. ReadableStreamDefaultReader.read() fast path:
   When data is already buffered in the controller's queue, return
   PromiseResolve() directly without creating a DefaultReadRequest
   object. This is spec-compliant because read() returns a Promise,
   and resolved promises still run callbacks in the microtask queue.

2. pipeTo() batch read fast path:
   When data is buffered, batch reads directly from the controller
   queue up to highWaterMark without creating
   PipeToReadableStreamReadRequest objects per chunk. Respects
   backpressure by checking desiredSize after each write.

Benchmark results:
  - pipeTo:          ~11% faster (***)
  - buffered read(): ~17-20% faster (***)

Co-Authored-By: Malte Ubl <malte@vercel.com>
PR-URL: https://github.com/nodejs/node/pull/61807
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
2026-07-19 17:30:43 -05:00
Efe c34d610ffc http: remove redundant keepAliveTimeoutBuffer assignment
PR-URL: https://github.com/nodejs/node/pull/61743
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2026-07-19 17:30:43 -05:00
RajeshKumar11 b75073d5aa http: attach error handler to socket synchronously in onSocket
Between onSocket and onSocketNT, the socket had no error handler,
meaning any errors emitted during that window (e.g. from a blocklist
check or custom lookup) would be unhandled even if the user had set up
a request error handler.

Fix this by attaching socketErrorListener synchronously in onSocket,
setting socket._httpMessage so the listener can forward errors to the
request. The _destroy path in onSocketNT is also guarded to prevent
double-firing if socketErrorListener already emitted the error.

Fixes: https://github.com/nodejs/node/issues/48771
Refs: https://github.com/nodejs/node/pull/61658
PR-URL: https://github.com/nodejs/node/pull/61770
Refs: https://github.com/nodejs/node/issues/48771
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-07-19 17:30:42 -05:00
giulioAZGiulio ComiCaleb EverettUtku Yildirim
a944283631 worker: eliminate race condition in process.cwd()
Fixes a race condition in worker thread cwd caching where the counter
is incremented before the directory change completes, allowing workers
to cache stale directory values.

In lib/internal/worker.js, the main thread's process.chdir() wrapper
previously incremented the shared counter before calling the actual
chdir(), creating a race window where workers could read the old
directory but cache it with the new counter value. This caused
subsequent cwd() calls to return incorrect paths until the next chdir().

This fix reorders the operations to change the directory first, then
increment the counter, ensuring workers are only notified after the
directory change completes.

Before fix: 54.28% error rate (311/573 races)
After fix: 0% error rate (0/832 races)

Refs: https://hackerone.com/reports/3407207
Co-authored-by: Giulio Comi
Co-authored-by: Caleb Everett
Co-authored-by: Utku Yildirim
PR-URL: https://github.com/nodejs/node/pull/61664
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
2026-07-19 17:30:42 -05:00
Chengzhong Wu f9cb30172c test: print stack immediately avoiding GC interleaving
`require(mod)` does not keep the mod in require cache if
mod throws synchronously. This fixes the tests to print
the stack immediately in case that source map cache could
be cleaned up when the CJS module is reclaimed by GC in
the next event loop tick.

PR-URL: https://github.com/nodejs/node/pull/61699
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-07-19 17:30:40 -05:00
RajeshKumar11 1f999d2c8b net: defer synchronous destroy calls in internalConnect
Defer socket.destroy() calls in internalConnect and
internalConnectMultiple to the next tick. This ensures that error
handlers have a chance to be set up before errors are emitted,
particularly important when using http.request with a custom
lookup function that returns synchronously.

Previously, if a synchronous lookup function returned an IP that
triggered an immediate error (e.g., via blockList), the error would
be emitted before the HTTP client had set up its error handler
(which happens via process.nextTick in onSocket). This caused
unhandled 'error' events.

Fixes: https://github.com/nodejs/node/issues/48771
PR-URL: https://github.com/nodejs/node/pull/61658
Refs: https://github.com/nodejs/node/pull/51038
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Jason Zhang <xzha4350@gmail.com>
2026-07-19 17:30:39 -05:00
Edy Silva 4edecac522 test_runner: fix test enqueue when test file has syntax error
PR-URL: https://github.com/nodejs/node/pull/61573
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
2026-07-19 17:30:36 -05:00
Robert Nagy 53d6e6d2bb lib: recycle queues
Avoid creating unnecessary garbage in the old space.

PR-URL: https://github.com/nodejs/node/pull/61461
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-07-19 17:30:36 -05:00
Mohamed Akram 27fb167f77 process: do not truncate long strings in --print
Fixes: https://github.com/nodejs/node/issues/61337
PR-URL: https://github.com/nodejs/node/pull/61497
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2026-07-19 17:30:36 -05:00
Abhishek Kv. Savani 1efdb58e9f test_runner: fix memory leaks in runner
- Close readline interface after child process exits
  Prevents accumulation of event listeners on stderr stream

- Extract watch mode event handler to named function
  Allows proper cleanup when watch mode is aborted

These changes prevent unbounded memory growth in long-running
test suites and watch mode sessions.

PR-URL: https://github.com/nodejs/node/pull/60860
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2026-07-19 17:30:34 -05:00
Heath Dutton🕴️ cba42aad5e test_runner: fix coverage report when a directory is named file
The coverage tree traversal checked `tree[key].file` to detect file
entries. When a directory named "file" contained a file also named
"file", this check incorrectly matched the child entry instead of
file metadata, causing a TypeError when accessing `.path`.

Check for `.file?.path` instead to correctly identify file metadata.

Fixes: https://github.com/nodejs/node/issues/61080
PR-URL: https://github.com/nodejs/node/pull/61169
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2026-07-19 17:30:34 -05:00
Xavier Stouder a3ae49d4a7 test_runner: print info when test restarts
When using spec reporter and running test in watch mode, print an info
message containing the current datetime when tests restart.

Fixes: https://github.com/nodejs/node/issues/57206
PR-URL: https://github.com/nodejs/node/pull/61160
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2026-07-19 17:30:34 -05:00