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

cli: allow running wasm in limited vmemory with --disable-wasm-trap-handler #52766

Closed
wants to merge 5 commits into from

Commits on May 2, 2024

  1. Configuration menu
    Copy the full SHA
    9d70355 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7857c4b View commit details
    Browse the repository at this point in the history
  3. tools: fix get_asan_state() in tools/test.py

    The output of `node -p process.config.variables.asan` includes
    a newline character so it's never exactly "1", which means
    asan is always "off" for the status files. This fixes the
    detection by stripping whitespaces from the output.
    joyeecheung committed May 2, 2024
    Configuration menu
    Copy the full SHA
    3d8aa53 View commit details
    Browse the repository at this point in the history
  4. cli: allow running wasm in limited vmemory with --disable-wasm-trap-h…

    …andler
    
    By default, Node.js enables trap-handler-based WebAssembly bound
    checks. As a result, V8 does not need to insert inline bound checks
    int the code compiled from WebAssembly which may speedup WebAssembly
    execution significantly, but this optimization requires allocating
    a big virtual memory cage (currently 10GB). If the Node.js process
    does not have access to a large enough virtual memory address space
    due to system configurations or hardware limitations, users won't
    be able to run any WebAssembly that involves allocation in this
    virtual memory cage and will see an out-of-memory error.
    
    ```console
    $ ulimit -v 5000000
    $ node -p "new WebAssembly.Memory({ initial: 10, maximum: 100 });"
    [eval]:1
    new WebAssembly.Memory({ initial: 10, maximum: 100 });
    ^
    
    RangeError: WebAssembly.Memory(): could not allocate memory
        at [eval]:1:1
        at runScriptInThisContext (node:internal/vm:209:10)
        at node:internal/process/execution:118:14
        at [eval]-wrapper:6:24
        at runScript (node:internal/process/execution:101:62)
        at evalScript (node:internal/process/execution:136:3)
        at node:internal/main/eval_string:49:3
    
    ```
    
    `--disable-wasm-trap-handler` disables this optimization so that
    users can at least run WebAssembly (with a less optimial performance)
    when the virtual memory address space available to their Node.js
    process is lower than what the V8 WebAssembly memory cage needs.
    joyeecheung committed May 2, 2024
    Configuration menu
    Copy the full SHA
    a087263 View commit details
    Browse the repository at this point in the history

Commits on May 7, 2024

  1. Configuration menu
    Copy the full SHA
    958ef09 View commit details
    Browse the repository at this point in the history