Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v18.20.0 proposal #52165

Merged
merged 77 commits into from
Mar 26, 2024
Merged

v18.20.0 proposal #52165

merged 77 commits into from
Mar 26, 2024

Conversation

richardlau
Copy link
Member

@richardlau richardlau commented Mar 20, 2024

2024-03-26, Version 18.20.0 'Hydrogen' (LTS), @richardlau

Notable Changes

Added support for import attributes

Support has been added for import attributes, to replace the old import
assertions syntax. This will aid migration by making the new syntax available
across all currently supported Node.js release lines.

This adds the with keyword which should be used in place of the previous
assert keyword, which will be removed in a future semver-major Node.js
release.

For example,

import "foo" assert { ... }

should be replaced with

import "foo" with { ... }

For more details, see

Contributed by Nicolò Ribaudo in #51136
and Antoine du Hamel in #50140.

Doc deprecation for dirent.path

Please use newly added dirent.parentPath instead.

Contributed by Antoine du Hamel in #50976
and #51020.

Experimental node-api feature flags

Introduces an experimental feature to segregate finalizers that affect GC state.
A new type called node_api_nogc_env has been introduced as the const version
of napi_env and node_api_nogc_finalize as a variant of napi_finalize that
accepts a node_api_nogc_env as its first argument.

This feature can be turned off by defining
NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT.

Contributed by Gabriel Schulhof in #50060.

Root certificates updated to NSS 3.98

Certificates added:

  • Telekom Security TLS ECC Root 2020
  • Telekom Security TLS RSA Root 2023

Certificates removed:

  • Security Communication Root CA

Updated dependencies

  • ada updated to 2.7.6.
  • base64 updated to 0.5.2.
  • c-ares updated to 1.27.0.
  • corepack updated to 0.25.2.
  • ICU updated to 74.2. Includes CLDR 44.1 and Unicode 15.1.
  • npm updated to 10.5.0. Fixes a regression in signals not being passed onto child processes.
  • simdutf8 updated to 4.0.8.
  • Timezone updated to 2024a.
  • zlib updated to 1.3.0.1-motley-40e35a7.

vm: fix V8 compilation cache support for vm.Script

Previously repeated compilation of the same source code using vm.Script
stopped hitting the V8 compilation cache after v16.x when support for
importModuleDynamically was added to vm.Script, resulting in a performance
regression that blocked users (in particular Jest users) from upgrading from
v16.x.

The recent fixes allow the compilation cache to be hit again
for vm.Script when --experimental-vm-modules is not used even in the
presence of the importModuleDynamically option, so that users affected by the
performance regression can now upgrade. Ongoing work is also being done to
enable compilation cache support for vm.CompileFunction.

Contributed by Joyee Cheung in #49950
and #50137.

Commits

  • [4b960c3a4a] - build: fix incorrect g++ warning message (Richard Lau) #51695
  • [8fdea67694] - crypto: update root certificates to NSS 3.98 (Node.js GitHub Bot) #51794
  • [812b126dd9] - deps: V8: cherry-pick d90d4533b053 (Michaël Zasso) #50077
  • [9ab8c3db87] - deps: update c-ares to 1.27.0 (Node.js GitHub Bot) #51846
  • [c688680387] - deps: update c-ares to 1.26.0 (Node.js GitHub Bot) #51582
  • [9498ac8a47] - deps: compile c-ares with C11 support (Michaël Zasso) #51410
  • [8fb743642f] - deps: update c-ares to 1.25.0 (Node.js GitHub Bot) #51385
  • [7bea2d7c12] - deps: update zlib to 1.3.0.1-motley-40e35a7 (Node.js GitHub Bot) #51274
  • [57a38c8f75] - deps: update zlib to 1.3.0.1-motley-dd5fc13 (Node.js GitHub Bot) #51105
  • [b0ca084a6b] - deps: update zlib to 1.3-22124f5 (Node.js GitHub Bot) #50910
  • [4b43823f37] - deps: update zlib to 1.2.13.1-motley-5daffc7 (Node.js GitHub Bot) #50803
  • [f0da591812] - deps: update zlib to 1.2.13.1-motley-dfc48fc (Node.js GitHub Bot) #50456
  • [16d28a883a] - deps: update base64 to 0.5.2 (Node.js GitHub Bot) #51455
  • [13a9e81cb6] - deps: update base64 to 0.5.1 (Node.js GitHub Bot) #50629
  • [b4502d3ac5] - deps: update simdutf to 4.0.8 (Node.js GitHub Bot) #51000
  • [183cf8a74a] - deps: update simdutf to 4.0.4 (Node.js GitHub Bot) #50772
  • [11ba8593ea] - deps: update ada to 2.7.6 (Node.js GitHub Bot) #51542
  • [73a946d55c] - deps: update ada to 2.7.5 (Node.js GitHub Bot) #51542
  • [cc434c1a39] - deps: update ada to 2.7.4 (Node.js GitHub Bot) #50815
  • [3a3808a6ae] - deps: upgrade npm to 10.5.0 (npm team) #51913
  • [c8876d765c] - deps: upgrade npm to 10.3.0 (npm team) #51431
  • [5aec3af460] - deps: update corepack to 0.25.2 (Node.js GitHub Bot) #51810
  • [a593985326] - deps: update corepack to 0.24.1 (Node.js GitHub Bot) #51459
  • [d1a9237bf5] - deps: update corepack to 0.24.0 (Node.js GitHub Bot) #51318
  • [adac0c7a63] - deps: update corepack to 0.23.0 (Node.js GitHub Bot) #50563
  • [4a6f83e32a] - deps: escape Python strings correctly (Michaël Zasso) #50695
  • [c13969e52a] - deps: V8: cherry-pick ea996ad04a68 (Nicolò Ribaudo) #51136
  • [6fbf0ba5c3] - deps: V8: cherry-pick a0fd3209dda8 (Nicolò Ribaudo) #51136
  • [68fd7516e1] - deps: update timezone to 2024a (Michaël Zasso) #51723
  • [f9b229ebe1] - deps: update icu to 74.2 (Michaël Zasso) #51723
  • [90c73d2eb4] - deps: update timezone to 2023d (Node.js GitHub Bot) #51461
  • [2a2bf57028] - deps: update icu to 74.1 (Node.js GitHub Bot) #50515
  • [425e011e52] - deps: add v8::Object::SetInternalFieldForNodeCore() (Joyee Cheung) #49874
  • [58c70344a2] - deps: V8: cherry-pick 705e374124ae (Joyee Cheung) #51004
  • [b0e88899e1] - deps: V8: cherry-pick 1fada6b36f8d (Joyee Cheung) #51004
  • [d87a810b81] - deps: V8: cherry-pick 3dd9576ce336 (Joyee Cheung) #51004
  • [6d50966876] - deps: V8: cherry-pick 94e8282325a1 (Joyee Cheung) #51004
  • [fafbacdfec] - deps: V8: cherry-pick 9a98f96b6d68 (Joyee Cheung) #51004
  • [d4a530ed8d] - deps: V8: cherry-pick 7f5daed62d47 (Joyee Cheung) #51004
  • [1ce901b164] - deps: V8: cherry-pick c400af48b5ef (Joyee Cheung) #51004
  • [f232064f35] - doc: fix historical experimental fetch flag (Kenrick) #51506
  • [194ff6a40f] - (SEMVER-MINOR) doc: add deprecation notice to dirent.path (Antoine du Hamel) #50976
  • [0f09267dc6] - (SEMVER-MINOR) doc: deprecate dirent.path (Antoine du Hamel) #50976
  • [8bfb8f5b2f] - doc,crypto: further clarify RSA_PKCS1_PADDING support (Tobias Nießen) #51799
  • [c7baf7b274] - doc,crypto: add changelog and note about disabled RSA_PKCS1_PADDING (Filip Skokan) #51782
  • [a193be3dc2] - esm: use import attributes instead of import assertions (Antoine du Hamel) #50140
  • [26e8f7793e] - (SEMVER-MINOR) fs: introduce dirent.parentPath (Antoine du Hamel) #50976
  • [5b5e5192f7] - lib: fix compileFunction throws range error for negative numbers (Jithil P Ponnan) #49855
  • [7552de6806] - module: fix the leak in SourceTextModule and ContextifySript (Joyee Cheung) #48510
  • [2e05cf1c60] - module: fix leak of vm.SyntheticModule (Joyee Cheung) #48510
  • [a86a2e14a3] - module: use symbol in WeakMap to manage host defined options (Joyee Cheung) #48510
  • [32906ddcac] - node-api: segregate nogc APIs from rest via type system (Gabriel Schulhof) #50060
  • [1aa71c26ff] - node-api: factor out common code into macros (Gabriel Schulhof) #50664
  • [3d0b233f52] - node-api: introduce experimental feature flags (Gabriel Schulhof) #50991
  • [96514a8b9f] - src: iterate on import attributes array correctly (Michaël Zasso) #50703
  • [2c2892bf88] - src: set ModuleWrap internal fields only once (Joyee Cheung) #49391
  • [ff334cb774] - src: cast v8::Object::GetInternalField() return value to v8::Value (Joyee Cheung) #48943
  • [95d7a75084] - test: fix dns test case failures after c-ares update to 1.21.0+ (Brad House) #50743
  • [cd613e5167] - test: handle relative https redirect (Richard Lau) #51121
  • [40f10eafcf] - test: fix internet/test-inspector-help-page (Richard Lau) #51693
  • [5e426511b1] - test: deflake test-vm-contextified-script-leak (Joyee Cheung) #49710
  • [0b156c6d28] - test: use checkIfCollectable in vm leak tests (Joyee Cheung) #49671
  • [1586c11b3c] - test: add checkIfCollectable to test/common/gc.js (Joyee Cheung) #49671
  • [902d8b3d4b] - test: fix flaky http-chunk-extensions-limit test (Ethan Arrowood) #51943
  • [1743d2bdc1] - test: test surrogate pair filenames on windows (Mert Can Altın) #51800
  • [1c1a7ec22d] - test: increase platform timeout zlib-brotli-16gb (Rafael Gonzaga) #51792
  • [931d02fe3e] - test, v8: fix wrong import attributes test (Nicolò Ribaudo) #52184
  • [d9ea6c1f8d] - tls: fix order of setting cipher before setting cert and key (Kumar Rishav) #50186
  • [3184befa2e] - tools: fix update-icu.sh (Michaël Zasso) #51723
  • [06646e11be] - (SEMVER-MINOR) vm: use import attributes instead of import assertions (Antoine du Hamel) #50141
  • [fe66e9d06e] - vm: reject in importModuleDynamically without --experimental-vm-modules (Joyee Cheung) #50137
  • [052e095c6b] - vm: use internal versions of compileFunction and Script (Joyee Cheung) #50137
  • [9f7899ed0a] - vm: unify host-defined option generation in vm.compileFunction (Joyee Cheung) #50137
  • [6291c107d0] - vm: use default HDO when importModuleDynamically is not set (Joyee Cheung) #49950

cc @nodejs/lts / @nodejs/releasers

richardlau and others added 30 commits February 28, 2024 17:44
The warning message was inadvertently changed to a newer version of
g++ than the one being checked for when a refactor PR was merged to
v18.x-staging.

Refs: #47667
PR-URL: #51695
Reviewed-By: Ruy Adorno <ruyadorno@google.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
PR-URL: #51792
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: #51782
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
PR-URL: #51799
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
PR-URL: #51800
Fixes: #51789
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Replace the setInterval with a queueMicrotask to make test less flaky.

Fixes: #51883
PR-URL: #51943
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Original commit message:

    [symbol-as-weakmap-key] Implement Symbol as WeakMap Keys

    Allow non-registered symbols as keys in weakmap and weakset.
    Allow non-registered symbols as target and unregisterToken in
    WeakRef and FinalizationRegistry.

    Bug: v8:12947
    Change-Id: Ieb63bda66e3cc378879ac651e23300b71caed627
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3865056
    Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
    Commit-Queue: Marja Hölttä <marja@chromium.org>
    Reviewed-by: Jakob Linke <jgruber@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83313}

Refs: v8/v8@c400af4
PR-URL: #51004
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Original commit message:

    [symbol-as-weakmap-key] Add tests to check weak collection size

    ... after gc.

    This CL also adds a runtime test function GetWeakCollectionSize
    to get the weak collection size.

    Bug: v8:12947
    Change-Id: I4aff39165a54b63b3d690bfea71c2a439da01d00
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3905071
    Reviewed-by: Marja Hölttä <marja@chromium.org>
    Commit-Queue: 王澳 <wangao.james@bytedance.com>
    Cr-Commit-Position: refs/heads/main@{#83464}

Refs: v8/v8@7f5daed
PR-URL: #51004
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Original commit message:

    [symbol-as-weakmap-key] Stage the feature

    Bug: v8:12947
    Change-Id: I0a151a6b301ee93675cc9f87a4fa24cb1be76462
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3928061
    Auto-Submit: Shu-yu Guo <syg@chromium.org>
    Commit-Queue: Marja Hölttä <marja@chromium.org>
    Reviewed-by: Marja Hölttä <marja@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83483}

Refs: v8/v8@9a98f96
PR-URL: #51004
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Original commit message:

    [symbol-as-weakmap-key] Fix DCHECKs and add CanBeHeldWeakly

    There are a few DCHECKs that weren't updated to allow for Symbols as
    weak collection keys. This CL updates those DCHECKs and also does the
    following refactors for clarity:

    - Add Object::CanBeHeldWeakly
    - Rename GotoIfCannotBeWeakKey -> GotoIfCannotBeHeldWeakly to align with
      spec AO name

    Bug: chromium:1370400, chromium:1370402, v8:12947
    Change-Id: I380840c8377497feae97e3fca37555dae0dcc255
    Fixed: chromium:1370400, chromium:1370402
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3928150
    Auto-Submit: Shu-yu Guo <syg@chromium.org>
    Reviewed-by: Marja Hölttä <marja@chromium.org>
    Commit-Queue: Marja Hölttä <marja@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83507}

Refs: v8/v8@94e8282
PR-URL: #51004
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Original commit message:

    [inspector] Support Symbols in EntryPreview

    The Symbols-as-WeakMap-keys proposal allows non-Symbol.for Symbol values
    in weak collections, which means it can show in EntryPreviews.

    Also apparently Symbols in regular Maps and Sets were also unsupported.

    Bug: v8:13350, v8:12947
    Change-Id: Ib10476fa2f3c7f59af67933f0bf61640be1bbd97
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3930037
    Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
    Reviewed-by: Simon Zünd <szuend@chromium.org>
    Commit-Queue: Shu-yu Guo <syg@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83518}

Refs: v8/v8@3dd9576
PR-URL: #51004
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Original commit message:

    [symbol-as-weakmap-key] Fix DCHECKs when clearing JS weakrefs

    Bug: chromium:1372500, v8:12947
    Fixed: chromium:1372500
    Change-Id: Id6330de5886e4ea72544b307c358e2190ea47d9c
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3942586
    Reviewed-by: Anton Bikineev <bikineev@chromium.org>
    Commit-Queue: Shu-yu Guo <syg@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83632}

Refs: v8/v8@1fada6b
PR-URL: #51004
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Original commit message:

    [symbol-as-weakmap-key] Ship the proposal

    I2S with 3 LGTMs:
    https://groups.google.com/a/chromium.org/g/blink-dev/c/E6pDZP_TiBA/m/ZcXLwiz8AAAJ

    Bug: v8:12947
    Change-Id: Ibce4abc8b0610afb2041d44cc9ed136db8b62c0d
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4004610
    Commit-Queue: Shu-yu Guo <syg@chromium.org>
    Reviewed-by: Camillo Bruni <cbruni@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#84128}

Refs: v8/v8@705e374
PR-URL: #51004
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
PR-URL: #49855
Backport-PR-URL: #51004
Fixes: #49848
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
In preparation of https://chromium-review.googlesource.com/c/v8/v8/+/4707972
which changes the return value to v8::Data.

PR-URL: #48943
Backport-PR-URL: #51004
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
This is a non-ABI breaking solution for
v8/v8@b60a03d
and
v8/v8@0aa622e
which are necessary for backporting vm-related memory fixes to v18.x.

PR-URL: #49874
Backport-PR-URL: #51004
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
There is no need to initialize the internal fields to undefined
and then initialize them to something else in the caller. Simply
pass the internal fields into the constructor to initialize
them just once.

PR-URL: #49391
Backport-PR-URL: #51004
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Previously when managing the importModuleDynamically callback of
vm.compileFunction(), we use an ID number as the host defined option
and maintain a per-Environment ID -> CompiledFnEntry map to retain
the top-level referrer function returned by vm.compileFunction() in
order to pass it back to the callback, but it would leak because with
how we used v8::Persistent to maintain this reference, V8 would not
be able to understand the cycle and would just think that the
CompiledFnEntry was supposed to live forever. We made an attempt
to make that reference known to V8 by making the CompiledFnEntry weak
and using a private symbol to make CompiledFnEntry strongly
references the top-level referrer function in
#46785, but that turned out to be
unsound, because the there's no guarantee that the top-level function
must be alive while import() can still be initiated from that
function, since V8 could discard the top-level function and only keep
inner functions alive, so relying on the top-level function to keep
the CompiledFnEntry alive could result in use-after-free which caused
a revert of that fix.

With this patch we use a symbol in the host defined options instead of
a number, because with the stage-3 symbol-as-weakmap-keys proposal
we could directly use that symbol to keep the referrer alive using a
WeakMap. As a bonus this also keeps the other kinds of referrers
alive as long as import() can still be initiated from that
Script/Module, so this also fixes the long-standing crash caused by
vm.Script being GC'ed too early when its importModuleDynamically
callback still needs it.

PR-URL: #48510
Backport-PR-URL: #51004
Refs: #44211
Refs: #42080
Refs: #47096
Refs: #43205
Refs: #38695
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Previously we maintain a strong persistent reference to the
ModuleWrap to retrieve the ID-to-ModuleWrap mapping from
the HostImportModuleDynamicallyCallback using the number ID
stored in the host-defined options. As a result the ModuleWrap
would be kept alive until the Environment is shut down, which
would be a leak for user code. With the new symbol-based
host-defined option we can just get the ModuleWrap from the
JS-land WeakMap so there's now no need to maintain this
strong reference. This would at least fix the leak for
vm.SyntheticModule. vm.SourceTextModule is still leaking
due to the strong persistent reference to the v8::Module.

PR-URL: #48510
Backport-PR-URL: #51004
Refs: #44211
Refs: #42080
Refs: #47096
Refs: #43205
Refs: #38695
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Replace the persistent handles to v8::Module and
v8::UnboundScript with an internal reference that V8's GC is
aware of to fix the leaks.

PR-URL: #48510
Backport-PR-URL: #51004
Refs: #44211
Refs: #42080
Refs: #47096
Refs: #43205
Refs: #38695
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
PR-URL: #49671
Backport-PR-URL: #51004
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Previously we simply create a lot of the target objects and check
if the process crash due to OOM. Due to how we use emphemeron GC
to handle memory management, which is inefficient but necessary
for correctness, the tests can produce false positives as
the GC isn't efficient enough to catch up with a very fast
heap growth.

This patch uses a new checkIfCollectable() utility to terminate the
test early once we detect that any of the target object can actually
be garbage collected. This should lower the chance of false positives.
As a drive-by this also allows us to use setImmediate() to grow the
heap even faster to make the tests run faster.

PR-URL: #49671
Backport-PR-URL: #51004
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Similar to the test-vm-source-text-module-leak fix, use a snapshot
to force a thorough GC in order to prevent false positives.

PR-URL: #49710
Backport-PR-URL: #51004
Refs: nodejs/reliability#669
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This makes it possile to hit the in-isolate compilation cache when
host-defined options are not necessary.

PR-URL: #49950
Backport-PR-URL: #51004
Refs: #35375
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Set a default host-defined option for vm.compileFunction so that
it's consistent with vm.Script.

PR-URL: #50137
Backport-PR-URL: #51004
Refs: #35375
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Instead of using the public versions of the vm APIs internally,
use the internal versions so that we can skip unnecessary
argument validation.

The public versions would need special care to the generation
of host-defined options to hit the isolate compilation cache
when imporModuleDynamically isn't used, while internally it's
almost always used, so this allows us to handle the host-defined
options separately.

PR-URL: #50137
Backport-PR-URL: #51004
Refs: #35375
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Users cannot access any API that can be used to return a module or
module namespace in this callback without --experimental-vm-modules
anyway, so this would eventually lead to a rejection. This patch
rejects in this case with our own error message and use a constant
host-defined option for the rejection, so that scripts with the
same source can still be compiled using the compilation cache
if no `import()` is actually called in the script.

PR-URL: #50137
Backport-PR-URL: #51004
Refs: #35375
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: #50515
Backport-PR-URL: #51973
Reviewed-By: Steven R Loomis <srl295@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Refs: #51933
PR-URL: #51461
Backport-PR-URL: #51973
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Refs: #51933
The name of the sources MD5 file has changed.

Refs: https://github.com/unicode-org/icu/releases/tag/release-74-2
PR-URL: #51723
Backport-PR-URL: #51973
Refs: #51721
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Steven R Loomis <srl295@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Refs: #51933
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 22, 2024
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Mar 22, 2024

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@dy-dx
Copy link

dy-dx commented Mar 23, 2024

Could I request for cb85073 to be backported into this release? (as well as the next v20 release)
It fixes an issue introduced in nodejs 18.16, that is affecting users of the unzipper package.
(Apologies if this is the wrong channel for this kind of request)

shipujin and others added 3 commits March 23, 2024 18:40
PR-URL: #50209
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Fixes: #51993
PR-URL: #52005
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Notable changes:

Added support for import attributes:

Support has been added for import attributes, to replace the old import
assertions syntax. This will aid migration by making the new syntax
available across all currently supported Node.js release lines.

For more details, see

* [#50134](#50134)
* [#51622](#51622)

Doc deprecation for `dirent.path`:

Please use newly added `dirent.parentPath` instead.

Experimental node-api feature flags

Introduces an experimental feature to segregate finalizers that affect GC state.
A new type called `node_api_nogc_env` has been introduced as the const version
of `napi_env` and `node_api_nogc_finalize` as a variant of `napi_finalize` that
accepts a `node_api_nogc_env` as its first argument.

This feature can be turned off by defining
`NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT`.

Root certificates updated to NSS 3.98:

Certificates added:

* Telekom Security TLS ECC Root 2020
* Telekom Security TLS RSA Root 2023

Certificates removed:

* Security Communication Root CA

Updated dependencies:

* ada updated to 2.7.6.
* base64 updated to 0.5.2.
* c-ares updated to 1.27.0.
* corepack updated to 0.25.2.
* ICU updated to 74.2. Includes CLDR 44.1 and Unicode 15.1.
* npm updated to 10.5.0. Fixes a regression in signals not being passed onto child processes.
* simdutf8 updated to 4.0.8.
* Timezone updated to 2024a.
* zlib updated to 1.3.0.1-motley-40e35a7.

vm: fix V8 compilation cache support for vm.Script:

Previously repeated compilation of the same source code using `vm.Script`
stopped hitting the V8 compilation cache after v16.x when support for
`importModuleDynamically` was added to `vm.Script`, resulting in a performance
regression that blocked users (in particular Jest users) from upgrading from
v16.x.

The recent fixes allow the compilation cache to be hit again
for `vm.Script` when `--experimental-vm-modules` is not used even in the
presence of the `importModuleDynamically` option, so that users affected by the
performance regression can now upgrade. Ongoing work is also being done to
enable compilation cache support for `vm.CompileFunction`.

PR-URL: #52165
@richardlau richardlau added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 23, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 23, 2024
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Mar 24, 2024

CI: https://ci.nodejs.org/job/node-test-pull-request/57928/
V8 CI: https://ci.nodejs.org/job/node-test-commit-v8-linux/5872/
CITGM 18.19.1: https://ci.nodejs.org/job/citgm-smoker/3406/
CITGM 18.20.0-proposal: https://ci.nodejs.org/job/citgm-smoker/3405/

$ ncu-ci citgm 3406 3405
--------------------------------------------------------------------------------
[1/1] Running CITGM: 3406
--------------------------------------------------------------------------------
✔  Summary data downloaded
✔  Results data downloaded
✔  Summary data downloaded
✔  Results data downloaded
----------------------------------- Summary ------------------------------------
Result     FAILURE
URL        https://ci.nodejs.org/job/citgm-smoker/3406/
Source     https://api.github.com/repos/nodejs/node/git/refs/tags/v18.19.1
Commit     [6610cc42ff50] 2024-02-14, Version 18.19.1 'Hydrogen' (LTS)
Date       2024-02-13 18:26:36 -0300
Author     Rafael Gonzaga <rafael.nunu@hotmail.com>
----------------------------------- Summary ------------------------------------
Result     FAILURE
URL        https://ci.nodejs.org/job/citgm-smoker/3405/
Source     https://api.github.com/repos/nodejs/node/git/refs/heads/v18.20.0-proposal
Commit     [f75dc4193e3f] 2024-03-26, Version 18.20.0 'Hydrogen' (LTS)
Date       2024-03-23 18:56:11 +0000
Author     Richard Lau <rlau@redhat.com>
----------------------------------- Results ------------------------------------



FAILURE: 5 failures in 3405 not present in 3406


┌────────────────────────┬──────────────────┬───────────────────────┐
│ (index)                │ 0                │ 1                     │
├────────────────────────┼──────────────────┼───────────────────────┤
│ alpine-last-latest-x64 │ 'clinic-v13.0.0' │                       │
│ rhel8-ppc64le          │                  │                       │
│ rhel8-s390x            │                  │                       │
│ aix72-ppc64            │                  │                       │
│ debian12-x64           │                  │                       │
│ osx11                  │                  │                       │
│ alpine-latest-x64      │ 'clinic-v13.0.0' │ 'multer-v1.4.5-lts.1' │
│ ubuntu2204-64          │ 'clinic-v13.0.0' │ 'jest-v29.7.0'        │
└────────────────────────┴──────────────────┴───────────────────────┘

Release build for f75dc41: https://ci-release.nodejs.org/job/iojs+release/10060/

@richardlau richardlau merged commit f75dc41 into v18.x Mar 26, 2024
55 checks passed
@richardlau richardlau deleted the v18.20.0-proposal branch March 26, 2024 17:24
richardlau added a commit that referenced this pull request Mar 26, 2024
richardlau added a commit that referenced this pull request Mar 26, 2024
Notable changes:

Added support for import attributes:

Support has been added for import attributes, to replace the old import
assertions syntax. This will aid migration by making the new syntax
available across all currently supported Node.js release lines.

For more details, see

* [#50134](#50134)
* [#51622](#51622)

Doc deprecation for `dirent.path`:

Please use newly added `dirent.parentPath` instead.

Experimental node-api feature flags

Introduces an experimental feature to segregate finalizers that affect GC state.
A new type called `node_api_nogc_env` has been introduced as the const version
of `napi_env` and `node_api_nogc_finalize` as a variant of `napi_finalize` that
accepts a `node_api_nogc_env` as its first argument.

This feature can be turned off by defining
`NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT`.

Root certificates updated to NSS 3.98:

Certificates added:

* Telekom Security TLS ECC Root 2020
* Telekom Security TLS RSA Root 2023

Certificates removed:

* Security Communication Root CA

Updated dependencies:

* ada updated to 2.7.6.
* base64 updated to 0.5.2.
* c-ares updated to 1.27.0.
* corepack updated to 0.25.2.
* ICU updated to 74.2. Includes CLDR 44.1 and Unicode 15.1.
* npm updated to 10.5.0. Fixes a regression in signals not being passed onto child processes.
* simdutf8 updated to 4.0.8.
* Timezone updated to 2024a.
* zlib updated to 1.3.0.1-motley-40e35a7.

vm: fix V8 compilation cache support for vm.Script:

Previously repeated compilation of the same source code using `vm.Script`
stopped hitting the V8 compilation cache after v16.x when support for
`importModuleDynamically` was added to `vm.Script`, resulting in a performance
regression that blocked users (in particular Jest users) from upgrading from
v16.x.

The recent fixes allow the compilation cache to be hit again
for `vm.Script` when `--experimental-vm-modules` is not used even in the
presence of the `importModuleDynamically` option, so that users affected by the
performance regression can now upgrade. Ongoing work is also being done to
enable compilation cache support for `vm.CompileFunction`.

PR-URL: #52165
richardlau added a commit to nodejs/nodejs.org that referenced this pull request Mar 26, 2024
github-merge-queue bot pushed a commit to nodejs/nodejs.org that referenced this pull request Mar 26, 2024
@tcobbs-bentley
Copy link

Was it intentional to include the following PR (clearly described as being for Node v20) in v18.20.0?

#49874

@nicolo-ribaudo
Copy link
Contributor

Yes it was explicitly backported in #51004

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release Issues and PRs related to Node.js releases. v18.x Issues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.