44097 Commits

Author SHA1 Message Date
James M Snell
49bb0ae8c6 src: use macros to reduce code duplication is cares_wrap
PR-URL: https://github.com/nodejs/node/pull/57937
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-04-27 07:29:39 -07:00
James M Snell
f114dbee9d src: improve error handling in cares_wrap
PR-URL: https://github.com/nodejs/node/pull/57937
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-04-27 07:29:37 -07:00
Gerhard Stöbich
e716081f19
test: add ALS test using http agent keep alive
Add a test to verify AsyncLocalStore functionality for HTTP using a
keep alive agent.

AsyncLocalStore moves away from using async_hooks therefore relying on
async_hooks tests alone is not longer valid.

PR-URL: https://github.com/nodejs/node/pull/58017
Refs: https://github.com/nodejs/node/issues/55712
Refs: https://github.com/nodejs/node/issues/13325
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-04-27 06:59:57 +00:00
Tim Perry
4cd8e1914a http2: add raw header array support to h2Session.request()
This also notably changes error handling for request(). Previously some
invalid header values (but not all) would cause the session to be
unnecessarily destroyed automatically, e.g. passing an unparseable
header name to request(). This is no longer the case: header validation
failures will throw an error, but will not destroy the session or emit
'error' events.

PR-URL: https://github.com/nodejs/node/pull/57917
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-04-26 09:27:27 -07:00
0hm☘️🏳️‍⚧️
a8a86b3adb
lib: resolve the issue of not adhering to the specified buffer size
We create a `queueHandler`, and in every iteration we execute
the handlers in the `queueHandler` until we get a non-null result.

PR-URL: https://github.com/nodejs/node/pull/55896
Refs: https://github.com/nodejs/node/issues/55764
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-04-26 15:38:15 +00:00
Jacob Smith
cf896c3b12
test_runner: support mocking json modules
PR-URL: https://github.com/nodejs/node/pull/58007
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2025-04-26 14:56:24 +00:00
Antoine du Hamel
3e996dff22
build: fix zstd libname
PR-URL: https://github.com/nodejs/node/pull/57999
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Jan Martin <jan.krems@gmail.com>
2025-04-26 11:06:42 +02:00
Dario Piotrowicz
b673c697a7
Revert "readline: add stricter validation for functions called after closed"
This reverts commit 8e7f32f968a723bc8811e9f146876a1061f7941b.

PR-URL: https://github.com/nodejs/node/pull/58024
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2025-04-25 22:45:58 +00:00
Chengzhong Wu
3b90f3454d
node-api: add nested object wrap and napi_ref test
Test that an napi_ref can be nested inside another ObjectWrap. The test
shows a critical case where a finalizer deletes an `napi_ref` whose
finalizer is also scheduled.

PR-URL: https://github.com/nodejs/node/pull/57981
Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2025-04-25 22:22:30 +00:00
Daniel Lemire
25fe802fdc
src: use ranges library (C++20) to simplify code
PR-URL: https://github.com/nodejs/node/pull/57975
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
2025-04-25 17:52:42 +00:00
Joyee Cheung
9cc0195759
http2: use args.This() instead of args.Holder()
args.Holder() has been removed in newer version of V8.

PR-URL: https://github.com/nodejs/node/pull/58004
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-04-25 01:52:09 +00:00
Calvin
4c764c84c5
doc: reserve module version 136 for Electron 37
PR-URL: https://github.com/nodejs/node/pull/57979
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
2025-04-24 20:35:10 +00:00
René
6db150dddf
doc: correct deprecation type of assert.CallTracker
PR-URL: https://github.com/nodejs/node/pull/57997
Refs: https://github.com/nodejs/node/pull/47740
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-04-24 20:10:26 +00:00
Rich Trott
1b5b12c3e6
tools: ignore test directory in CodeQL scans
Scanning the test directory results in many false positives about
hard-coded credentials. We want the code scan for
user-exectuable code and possibly our tools, but not generally
for tests. Ignore the test directory in CodeQL scans. A long list
of false positives makes it harder to interpret the result of CodeQL
runs.

PR-URL: https://github.com/nodejs/node/pull/57978
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-04-24 18:52:25 +00:00
Dario Piotrowicz
b665127963
watch: clarify completion/failure watch mode messages
clarify the messages that `node --watch` presents to the user
when the process terminates (either successfully or because of
some error) by clearly conveying that node is waiting for new
file changes before restarting the process

PR-URL: https://github.com/nodejs/node/pull/57926
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
2025-04-24 14:00:24 +00:00
Antoine du Hamel
5d15cbb416
crypto: fix cross-realm SharedArrayBuffer validation
PR-URL: https://github.com/nodejs/node/pull/57974
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-04-24 13:28:51 +00:00
Naor Tedgi (Abu Emma)
2c315d24f5
doc: fix AsyncLocalStorage example response changes after node v18
PR-URL: https://github.com/nodejs/node/pull/57969
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-04-24 07:54:33 +00:00
Luigi Pinca
555aeb3aae
test: deflake test-http2-options-max-headers-block-length
The socket can be closed while data is still being written, causing an
`ECONNRESET` error to be emitted on the client. Add a listener for it.

PR-URL: https://github.com/nodejs/node/pull/57959
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2025-04-24 05:08:08 +00:00
Matteo Collina
bd3f27166b
meta: allow penetration testing on live system with prior authorization
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/57966
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2025-04-23 15:42:25 +00:00
Shelley Vohr
7bc37af0f7
src: fix -Wunreachable-code-return in node_sea
PR-URL: https://github.com/nodejs/node/pull/57664
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-04-23 10:13:23 +00:00
Antoine du Hamel
d19437d859
doc: fix linter errors
PR-URL: https://github.com/nodejs/node/pull/57987
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2025-04-23 08:59:33 +00:00
RafaelGSS
71f8c3be1f
2025-04-23, Version 22.15.0 'Jod' (LTS)
Notable changes:

assert:
  * (SEMVER-MINOR) implement partial error comparison (Ruben Bridgewater) https://github.com/nodejs/node/pull/57370
  * (SEMVER-MINOR) improve partialDeepStrictEqual (Ruben Bridgewater) https://github.com/nodejs/node/pull/57370
cli:
  * (SEMVER-MINOR) allow --cpu-prof* in NODE_OPTIONS (Carlos Espa) https://github.com/nodejs/node/pull/57018
crypto:
  * update root certificates to NSS 3.108 (Node.js GitHub Bot) https://github.com/nodejs/node/pull/57381
  * (SEMVER-MINOR) support --use-system-ca on Windows (Joyee Cheung) https://github.com/nodejs/node/pull/56833
  * (SEMVER-MINOR) added support for reading certificates from macOS system store (Tim Jacomb) https://github.com/nodejs/node/pull/56599
deps:
  * update timezone to 2025a (Node.js GitHub Bot) https://github.com/nodejs/node/pull/56876
deps,tools:
  * (SEMVER-MINOR) add zstd 1.5.6 (Jan Martin) https://github.com/nodejs/node/pull/52100
dns:
  * (SEMVER-MINOR) add TLSA record query and parsing (Rithvik Vibhu) https://github.com/nodejs/node/pull/52983
doc:
  * add @geeksilva97 to collaborators (Edy Silva) https://github.com/nodejs/node/pull/57241
module:
  * (SEMVER-MINOR) use synchronous hooks for preparsing in import(cjs) (Joyee Cheung) https://github.com/nodejs/node/pull/55698
  * (SEMVER-MINOR) implement module.registerHooks() (Joyee Cheung) https://github.com/nodejs/node/pull/55698
process:
  * (SEMVER-MINOR) add execve (Paolo Insogna) https://github.com/nodejs/node/pull/56496
  * (SEMVER-MINOR) add threadCpuUsage (Paolo Insogna) https://github.com/nodejs/node/pull/56467
sqlite:
  * (SEMVER-MINOR) add StatementSync.prototype.columns() (Colin Ihrig) https://github.com/nodejs/node/pull/57490
  * (SEMVER-MINOR) allow returning `ArrayBufferView`s from user-defined functions (René) https://github.com/nodejs/node/pull/56790
src:
  * set signal inspector io thread name (RafaelGSS) https://github.com/nodejs/node/pull/56416
  * set thread name for main thread and v8 worker (RafaelGSS) https://github.com/nodejs/node/pull/56416
  * set worker thread name using worker.name (RafaelGSS) https://github.com/nodejs/node/pull/56416
  * use a default thread name for inspector (RafaelGSS) https://github.com/nodejs/node/pull/56416
tls:
  * (SEMVER-MINOR) implement tls.getCACertificates() (Joyee Cheung) https://github.com/nodejs/node/pull/57107
util:
  * (SEMVER-MINOR) expose diff function used by the assertion errors (Giovanni Bucci) https://github.com/nodejs/node/pull/57462
v8:
  * (SEMVER-MINOR) add v8.getCppHeapStatistics() method (Aditi) https://github.com/nodejs/node/pull/57146
zlib:
  * (SEMVER-MINOR) add zstd support (Jan Martin) https://github.com/nodejs/node/pull/52100

PR-URL: https://github.com/nodejs/node/pull/57840
2025-04-23 09:11:57 +02:00
Dario Piotrowicz
8e7f32f968 readline: add stricter validation for functions called after closed
PR-URL: https://github.com/nodejs/node/pull/57680
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-04-22 19:27:58 -07:00
Jonas
68cc1c9cd3
src: add dcheck_eq for Object::New constructor calls
PR-URL: https://github.com/nodejs/node/pull/57943
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-04-22 19:21:15 +00:00
Yagiz Nizipli
1720b18260
src: move windows specific fns to _WIN32
PR-URL: https://github.com/nodejs/node/pull/57951
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
2025-04-22 18:02:17 +02:00
Yagiz Nizipli
1c0a40518c
src: avoid calling SetPrototypeV2()
PR-URL: https://github.com/nodejs/node/pull/57949
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-04-22 15:27:11 +00:00
Wuli Zuo
367d5939e4 src: change DCHECK to CHECK
PR-URL: https://github.com/nodejs/node/pull/57948
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-04-22 14:45:49 +00:00
Wuli Zuo
fba9c27861 test: rename to getCallSites
PR-URL: https://github.com/nodejs/node/pull/57948
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-04-22 14:45:48 +00:00
Felipe Forbeck
6bf7fd7f4e
crypto: fix cross-realm check of ArrayBuffer
This patch modifies the `isNonSharedArrayBuffer` function in the WebIDL
implementation for the SubtleCrypto API to properly handle `ArrayBuffer`
instances created in different JavaScript realms.

Before this fix, when a `TypedArray.buffer` from a different realm
(e.g., from a VM context or worker thread) was passed to
`SubtleCrypto.digest()`, it would fail with:

> TypeError: Failed to execute 'digest' on 'SubtleCrypto': 2nd argument
> is not instance of ArrayBuffer, Buffer, TypedArray, or DataView."

The fix use the `isArrayBuffer` function from `internal/util/types` to
detect cross-realm `ArrayBuffer` instances when the prototype chain
check fails.

PR-URL: https://github.com/nodejs/node/pull/57828
Refs: https://github.com/storacha/w3up/issues/1591
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2025-04-22 15:01:21 +02:00
Node.js GitHub Bot
d74c498735
2025-04-22, Version 20.19.1 'Iron' (LTS)
Notable changes:

deps:
  * update undici to 6.21.2 (Matteo Collina) [#57442](https://github.com/nodejs/node/pull/57442)
  * update c-ares to v1.34.5 (Node.js GitHub Bot) [#57792](https://github.com/nodejs/node/pull/57792)

PR-URL: https://github.com/nodejs/node/pull/57896
2025-04-22 12:00:58 +02:00
Shelley Vohr
d12ee6e9ca
src: improve thread safety of TaskQueue
PR-URL: https://github.com/nodejs/node/pull/57910
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2025-04-22 08:42:41 +00:00
Luigi Pinca
a365da6b0c
meta: fix subsystem in commit title
"config" is not recognized as a valid subsystem by
`core-validate-commit@4.1.0`.

Refs: https://github.com/nodejs/node/commit/478a2e656d803970e93c
PR-URL: https://github.com/nodejs/node/pull/57945
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-04-22 06:43:48 +00:00
Node.js GitHub Bot
085b0281d9
deps: update zstd to 1.5.7
PR-URL: https://github.com/nodejs/node/pull/57940
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-04-22 00:52:12 +00:00
Node.js GitHub Bot
9761584b66
deps: update simdutf to 6.5.0
PR-URL: https://github.com/nodejs/node/pull/57939
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-04-22 00:52:03 +00:00
Edy Silva
e9b286ca4b
sqlite: add location method
PR-URL: https://github.com/nodejs/node/pull/57860
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-04-21 14:57:15 +00:00
Augustin Mauroy
64d9b7c5f8
util: fix parseEnv handling of invalid lines
PR-URL: https://github.com/nodejs/node/pull/57798
Fixes: https://github.com/nodejs/node/issues/56775
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
2025-04-21 06:46:44 +00:00
Antoine du Hamel
99dc2d376a
tools: add semver-major release support to release-lint
Co-authored-by: RafaelGSS <rafael.nunu@hotmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/57892
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
2025-04-21 06:33:57 +00:00
James M Snell
e773e09c3f
src: fixup errorhandling more in various places
PR-URL: https://github.com/nodejs/node/pull/57852
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-04-21 03:01:30 +00:00
Luigi Pinca
422529a2e3
test: force GC in test-file-write-stream4
Reduce `test/parallel/test-file-write-stream4.js` flakiness.

Refs: https://github.com/nodejs/node/pull/57927
PR-URL: https://github.com/nodejs/node/pull/57930
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-04-20 18:29:12 +00:00
Colin Ihrig
2e0ec72f54
sqlite: add getter to detect transactions
This commit adds an isTransaction getter to the DatabaseSync
class for determining if the database is currently within a
transaction.

Fixes: https://github.com/nodejs/node/issues/57922
PR-URL: https://github.com/nodejs/node/pull/57925
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
2025-04-20 15:57:42 +00:00
Wiyeong Seo
7102ea1559
os: fix netmask format check condition in getCIDR function
Modified to check the format of the netmask instead
of just checking that each part of the netmask is even

PR-URL: https://github.com/nodejs/node/pull/57324
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-04-20 05:54:48 +00:00
Michaël Zasso
25842c5e35
build: use clang-cl in coverage-windows workflow
And do not lose time trying to regenerate the project and rebuild
before running the tests.

PR-URL: https://github.com/nodejs/node/pull/57919
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-04-19 18:00:41 +00:00
fisker Cheung
0699a99bbe
worker: add ESM version examples to worker docs
PR-URL: https://github.com/nodejs/node/pull/57645
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-04-19 17:26:38 +00:00
Kushagra Pandey
609df89cd3 http2: session tracking and graceful server close
This change adds proper tracking of HTTP / 2 server sessions
to ensure they are gracefully closed when the server is
shut down.It implements:

- A new kSessions symbol for tracking active sessions
- Adding/removing sessions from a SafeSet in the server
- A closeAllSessions helper function to close active sessions
- Updates to Http2Server and Http2SecureServer close methods

Breaking Change: any client trying to create new requests
on existing connections will not be able to do so once
server close is initiated

Refs: https://datatracker.ietf.org/doc/html/rfc7540\#section-9.1
Refs: https://nodejs.org/api/http.html\#serverclosecallback

- improve HTTP/2 server shutdown to prevent race conditions

1. Fix server shutdown race condition
   - Stop listening for new connections before closing existing ones
   - Ensure server.close() properly completes in all scenarios

2. Improve HTTP/2 tests
   - Replace setTimeout with event-based flow control
   - Simplify test logic for better readability
   - Add clear state tracking for event ordering
   - Improve assertions to verify correct shutdown sequence

This eliminates a race condition where new sessions could connect
between the time existing sessions are closed and the server stops
listening, potentially preventing the server from fully shutting down.

- fix cross-platform test timing issues

Fix test-http2-server-http1-client.js failure on Ubuntu
by deferring server.close() to next event loop cycle.

The issue only affected Ubuntu where session close occurs
before error emission, causing the test to miss errors
when HTTP/1 clients connect to HTTP/2 servers.

Using setImmediate() ensures error events fire before
server close across all platforms while maintaining
recent session handling improvements.

PR-URL: https://github.com/nodejs/node/pull/57586
Fixes: https://github.com/nodejs/node/issues/57611
Refs: https://datatracker.ietf.org/doc/html/rfc7540#section-9.1
Refs: https://nodejs.org/api/http.html#serverclosecallback
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-04-19 10:17:12 -07:00
Node.js GitHub Bot
e273ddf7a4
deps: update undici to 7.8.0
PR-URL: https://github.com/nodejs/node/pull/57770
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2025-04-19 17:14:51 +00:00
Livia Medeiros
afd318db67
assert: support Float16Array in loose deep equality checks
PR-URL: https://github.com/nodejs/node/pull/57881
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-04-19 17:04:03 +00:00
Vladimir Morozov
c326200458
node-api: convert NewEnv to node_napi_env__::New
PR-URL: https://github.com/nodejs/node/pull/57834
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2025-04-19 17:03:53 +00:00
Kushagra Pandey
2acc8bc6a9
http2: fix graceful session close
Fix issue where session.close() prematurely destroys the session
when response.end() was called with an empty payload while active
http2 streams still existed. This change ensures that sessions are
closed gracefully only after all http2 streams complete and clients
properly receive the GOAWAY frame as per the HTTP/2 spec.

Refs: https://nodejs.org/api/http2.html\#http2sessionclosecallback
PR-URL: https://github.com/nodejs/node/pull/57808
Fixes: https://github.com/nodejs/node/issues/57809
Refs: https://nodejs.org/api/http2.html%5C#http2sessionclosecallback
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-04-19 16:36:03 +00:00
Luigi Pinca
2cff98c853
build: fix missing files warning
This commit fixes the following warning:

    Warning: Missing input files:
    C:\Users\lpinca\node\tools\v8_gypfiles\..\..\deps\v8\third_party\abseil-cpp\absl\strings\internal\has_absl_stringify.h
    C:\Users\lpinca\node\deps\ncrypto\dh-primes.h

https://github.com/nodejs/node/commit/bd3c25cf31282f101196 removed
`'<(ABSEIL_ROOT)/absl/strings/has_absl_stringify.h'` instead of
`'<(ABSEIL_ROOT)/absl/strings/internal/has_absl_stringify.h'`

Refs: https://github.com/nodejs/node/commit/5ab3140dfbf0dfa33a66
Refs: https://github.com/nodejs/node/commit/b9b4cb7731168671d8f4
PR-URL: https://github.com/nodejs/node/pull/57870
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-04-19 15:22:06 +00:00
Ruben Bridgewater
733e0fc2c4
assert,util: fix constructor lookup in deep equal comparison
The latest performance optimization did not take into account that
an object may have a property called constructor. This is addressed
in this PR by adding a new fast path and using fallbacks.

PR-URL: https://github.com/nodejs/node/pull/57876
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2025-04-19 11:10:40 +00:00