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

[v20.x] backport vm-related memory fixes #49874

Closed

Commits on Sep 28, 2023

  1. doc: promote fetch/webstreams from experimental to stable

    PR-URL: nodejs#45684
    Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
    Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
    Reviewed-By: Robert Nagy <ronagy@icloud.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
    Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
    styfle authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    0fbbe49 View commit details
    Browse the repository at this point in the history
  2. doc: add mertcanaltin as a triager

    PR-URL: nodejs#49826
    Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
    Reviewed-By: Qingyu Deng <i@ayase-lab.com>
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
    Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
    Reviewed-By: Darshan Sen <raisinten@gmail.com>
    Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
    Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
    Reviewed-By: LiviaMedeiros <livia@cirno.name>
    mert.altin authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    6a88c6a View commit details
    Browse the repository at this point in the history
  3. node-api: enable uncaught exceptions policy by default

    This enables the option `--force-node-api-uncaught-exceptions-policy`
    for a specific Node-API addon when it is compiled with
    `NAPI_EXPERIMENTAL` (and this would be the default behavior when
    `NAPI_VERSION` 10 releases). This would not break existing Node-API
    addons.
    
    PR-URL: nodejs#49313
    Refs: nodejs#36510
    Reviewed-By: Michael Dawson <midawson@redhat.com>
    Reviewed-By: Gabriel Schulhof <gabrielschulhof@gmail.com>
    legendecas authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    9600928 View commit details
    Browse the repository at this point in the history
  4. doc,tools: switch to @node-core/utils

    Refs: https://github.com/nodejs/node-core-utils/releases/tag/v4.0.0
    PR-URL: nodejs#49851
    Refs: nodejs/node-core-utils#700
    Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
    Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
    targos authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    ddf0e17 View commit details
    Browse the repository at this point in the history
  5. test: use mustSucceed instead of mustCall

    PR-URL: nodejs#49788
    Reviewed-By: Tobias Nießen <tniessen@tnie.de>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
    SiddharthDevulapalli authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    eded29c View commit details
    Browse the repository at this point in the history
  6. deps: V8: cherry-pick b33bf2dfd261

    Original commit message:
    
        Ignore --predictable when computing flag list hashes
    
        This allows reproducible code cache generation.
    
        Refs: nodejs#48749
    
        Change-Id: Ib4693de60ddff1fe41d95c10980f763463db3f95
        Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4681766
        Reviewed-by: Leszek Swirski <leszeks@chromium.org>
        Commit-Queue: Joyee Cheung <joyee@igalia.com>
        Cr-Commit-Position: refs/heads/main@{#88943}
    
    Refs: v8/v8@b33bf2d
    PR-URL: nodejs#49703
    Refs: v8/v8@de9a5de
    Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
    Reviewed-By: Michaël Zasso <targos@protonmail.com>
    Reviewed-By: Richard Lau <rlau@redhat.com>
    joyeecheung authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    1f16df2 View commit details
    Browse the repository at this point in the history
  7. deps: V8: backport de9a5de2274f

    Original commit message:
    
        Ignore flags implied by --predictable during hash computation
    
        https://chromium-review.googlesource.com/c/v8/v8/+/4681766 added
        code to ignore --predictable during hash computation of flags
        in order to produce reproducible code cache. This turns out to
        be not enough since the flags implied by --predictable also
        need to be ignored for it to work. This patch makes sure that
        they are ignored.
    
        Change-Id: Ifa36641efe3ca105706fd293be46fc974055d2d4
        Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4851287
        Commit-Queue: Joyee Cheung <joyee@igalia.com>
        Reviewed-by: Leszek Swirski <leszeks@chromium.org>
        Reviewed-by: Patrick Thier <pthier@chromium.org>
        Cr-Commit-Position: refs/heads/main@{#90022}
    
    Refs: v8/v8@de9a5de
    PR-URL: nodejs#49703
    Refs: v8/v8@b33bf2d
    Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
    Reviewed-By: Michaël Zasso <targos@protonmail.com>
    Reviewed-By: Richard Lau <rlau@redhat.com>
    joyeecheung authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    aea7371 View commit details
    Browse the repository at this point in the history
  8. doc: deprecate fs.F_OK, fs.R_OK, fs.W_OK, fs.X_OK

    PR-URL: nodejs#49683
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
    LiviaMedeiros authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    f4041ce View commit details
    Browse the repository at this point in the history
  9. doc: fix DEP0176 number

    PR-URL: nodejs#49858
    Refs: nodejs#49683
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
    Reviewed-By: Richard Lau <rlau@redhat.com>
    LiviaMedeiros authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    690cca3 View commit details
    Browse the repository at this point in the history
  10. test: mark test-runner-output as flaky

    This has been flaky on many platforms for months. Mark it as
    flaky for now to avoid blocking the CI.
    
    PR-URL: nodejs#49854
    Refs: nodejs#49853
    Refs: nodejs/reliability#673
    Reviewed-By: Tobias Nießen <tniessen@tnie.de>
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
    Reviewed-By: LiviaMedeiros <livia@cirno.name>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    joyeecheung authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    d2bcdcb View commit details
    Browse the repository at this point in the history
  11. fs: improve readFileSync with file descriptors

    PR-URL: nodejs#49691
    Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
    anonrig authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    07d0518 View commit details
    Browse the repository at this point in the history
  12. tools: support updating @reporters/github manually

    PR-URL: nodejs#49871
    Refs: nodejs@fbe28e2
    Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
    Reviewed-By: Michaël Zasso <targos@protonmail.com>
    Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
    MoLow authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    6db0d3d View commit details
    Browse the repository at this point in the history
  13. url: improve invalid url performance

    PR-URL: nodejs#49692
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Robert Nagy <ronagy@icloud.com>
    Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
    anonrig authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    7d91a73 View commit details
    Browse the repository at this point in the history
  14. stream: use bitmap in writable state

    PR-URL: nodejs#49834
    Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
    Reviewed-By: Robert Nagy <ronagy@icloud.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
    rluvaton authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    12fe6a0 View commit details
    Browse the repository at this point in the history
  15. test: deflake test-runner-output

    PR-URL: nodejs#49878
    Fixes: nodejs#49853
    Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
    Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
    MoLow authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    d44a812 View commit details
    Browse the repository at this point in the history
  16. perf_hooks: reduce overhead of new performance_entries

    PR-URL: nodejs#49803
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
    Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
    H4ad authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    f40b5ed View commit details
    Browse the repository at this point in the history
  17. fs: improve error performance for unlinkSync

    PR-URL: nodejs#49856
    Refs: nodejs/performance#106
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
    Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
    CanadaHonk authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    e82e46c View commit details
    Browse the repository at this point in the history
  18. fs: replace SetMethodNoSideEffect in node_file

    PR-URL: nodejs#49857
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
    Reviewed-By: Michaël Zasso <targos@protonmail.com>
    CanadaHonk authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    9363179 View commit details
    Browse the repository at this point in the history
  19. test: add os setPriority, getPriority test coverage

    PR-URL: nodejs#38771
    Reviewed-By: Darshan Sen <raisinten@gmail.com>
    waelsy123 authored and ruyadorno committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    1a18034 View commit details
    Browse the repository at this point in the history
  20. deps: add v8::Object::SetInternalFieldForNodeCore()

    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 v20.x.
    joyeecheung committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    f656122 View commit details
    Browse the repository at this point in the history
  21. module: use symbol in WeakMap to manage host defined options

    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
    nodejs#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: nodejs#48510
    Refs: nodejs#44211
    Refs: nodejs#42080
    Refs: nodejs#47096
    Refs: nodejs#43205
    Refs: nodejs#38695
    Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
    Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
    Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
    joyeecheung committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    35735ba View commit details
    Browse the repository at this point in the history
  22. module: fix leak of vm.SyntheticModule

    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: nodejs#48510
    Refs: nodejs#44211
    Refs: nodejs#42080
    Refs: nodejs#47096
    Refs: nodejs#43205
    Refs: nodejs#38695
    Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
    Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
    Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
    joyeecheung committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    23edd1d View commit details
    Browse the repository at this point in the history
  23. module: fix the leak in SourceTextModule and ContextifySript

    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: nodejs#48510
    Refs: nodejs#44211
    Refs: nodejs#42080
    Refs: nodejs#47096
    Refs: nodejs#43205
    Refs: nodejs#38695
    Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
    Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
    Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
    joyeecheung committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    2920904 View commit details
    Browse the repository at this point in the history
  24. test: add checkIfCollectable to test/common/gc.js

    PR-URL: nodejs#49671
    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>
    joyeecheung committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    7d916e2 View commit details
    Browse the repository at this point in the history
  25. test: use checkIfCollectable in vm leak tests

    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: nodejs#49671
    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>
    joyeecheung committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    8a47a18 View commit details
    Browse the repository at this point in the history
  26. test: deflake test-vm-contextified-script-leak

    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: nodejs#49710
    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>
    joyeecheung committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    1985233 View commit details
    Browse the repository at this point in the history