Repository navigation
Description
Bug report
What is the current behavior?
Attempting to run webpack leads to the following error:
$ npm view webpack version
5.70.0
$ npx webpack
[webpack-cli] RangeError: WebAssembly.Instance(): Out of memory: wasm memory
at create (/home/davedude/public_html/ConjunctionJunction/node_modules/webpack/lib/util/hash/wasm-hash.js:154:4)
at module.exports (/home/davedude/public_html/ConjunctionJunction/node_modules/webpack/lib/util/createHash.js:160:27)
at /home/davedude/public_html/ConjunctionJunction/node_modules/webpack/lib/DefinePlugin.js:289:22
at _next31 (eval at create (/home/davedude/public_html/ConjunctionJunction/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:40:1)
at _next9 (eval at create (/home/davedude/public_html/ConjunctionJunction/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:95:1)
at Hook.eval [as call] (eval at create (/home/davedude/public_html/ConjunctionJunction/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:117:1)
at Hook.CALL_DELEGATE [as _call] (/home/davedude/public_html/ConjunctionJunction/node_modules/tapable/lib/Hook.js:14:14)
at Compiler.newCompilation (/home/davedude/public_html/ConjunctionJunction/node_modules/webpack/lib/Compiler.js:1109:26)
at /home/davedude/public_html/ConjunctionJunction/node_modules/webpack/lib/Compiler.js:1153:29
at Hook.eval [as callAsync] (eval at create (/home/davedude/public_html/ConjunctionJunction/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
If the current behavior is a bug, please provide the steps to reproduce.
The issue first appeared in release 5.61:
$ npm install [email protected] --save-dev --fund=false --audit=false
changed 1 package in 824ms
$ npx webpack
...same issue...
$ npm install [email protected] --save-dev --fund=false --audit=false
changed 1 package in 891ms
$ npx webpack
assets by status 0 bytes [cached] 1 asset
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value.
Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
ERROR in main
Module not found: Error: Can't resolve './src' in '/home/davedude/public_html/ConjunctionJunction'
resolve './src' in '/home/davedude/public_html/ConjunctionJunction'
using description file: /home/davedude/public_html/ConjunctionJunction/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
using description file: /home/davedude/public_html/ConjunctionJunction/package.json (relative path: ./src)
no extension
Field 'browser' doesn't contain a valid alias configuration
/home/davedude/public_html/ConjunctionJunction/src doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/home/davedude/public_html/ConjunctionJunction/src.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/home/davedude/public_html/ConjunctionJunction/src.json doesn't exist
.wasm
Field 'browser' doesn't contain a valid alias configuration
/home/davedude/public_html/ConjunctionJunction/src.wasm doesn't exist
as directory
/home/davedude/public_html/ConjunctionJunction/src doesn't exist
webpack 5.60.0 compiled with 1 error and 1 warning in 148 ms
The repro environment is an empty package, no src/ directory. (It dies before that matters.)
The issue appears to be strongly related to this blog post: https://blog.stackblitz.com/posts/debugging-v8-webassembly/, which indicates that a fix in v8 was needed (or coding differently, to create fewer Instances).
I first encountered this issue with Node v12.22.10 (which is listed as supported), which has a v8 version well before the fix landed.
I also tried Node v14.19.1, which is the latest version available from Debian. Same issue.
The commit in Node that fixes the issue in V8 is here: nodejs/node@3e9939e
If I'm reading it right, that means this code only works with Node v17.2.0 or later. Or (more likely) there's an additional repro condition I don't know about.
What is the expected behavior?
Doesn't crash.
Other relevant information:
webpack version: 5.61+
Node.js version: v12.22.10, v14.19.1
Operating System: Debian/testing
Additional tools:
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
vankop commentedon Mar 25, 2022
Did you try with Node.js v16 ?
alexander-akait commentedon Mar 25, 2022
@d0sboots Can you provide more information, do you using snap/official repository or custom setup/build for Node.js?
d0sboots commentedon Mar 25, 2022
I was using the system-global version(s) of Node that come from Debian. 14.19.1 is the latest version on the unstable tree. I'll spend some time today trying different Node versions and report back.
d0sboots commentedon Mar 25, 2022
So, here's how this reproduces on my machine. Create an empty directory, install webpack and (optionally) a version of Node:
Trying to run webpack results in the error:
I was wrong in my guess about the instances fix in V8; using a Node version past 17.2.0 has no effect:
But it's definitely caused by a change in Webpack; syncing before the m4-based wasm hashing was introduced in 5.61 fixes it, always.
(The above is the error that the m4-based hashes were added to address, in Node 17. It works fine in earlier Nodes, you get a sensible error about lacking a src/ dir.)
alexander-akait commentedon Mar 28, 2022
What is npm version?
d0sboots commentedon Mar 29, 2022
alexander-akait commentedon Mar 29, 2022
I still can't reproduce, as you can see there is no 👍, maybe related to your env (broken node installation or due debian/testing)
d0sboots commentedon Apr 20, 2022
Got around to digging further on this. I suspected this was something specific to my env as well.
This shows that WASM is basically totally inoperable; trying to allocate anything at all is failing. I'll update again if/when I get to the bottom of this, so that if anyone else runs into the same issue they'll know how to fix it.
d0sboots commentedon Apr 21, 2022
I found the issue.
V8 uses 10GB memory allocations in WASM to implement guard regions. Most of this memory is never committed (actually given pages by the VM system), but the virtual address space is still consumed.
I had a 5GB ulimit set, for safety. Once that was removed, everything worked fine.
Alexsab commentedon Jun 3, 2022
@d0sboots how did you do that? I catch the same error
etayakee commentedon Jun 3, 2022
@d0sboots how did you do that? I catch the same error
d0sboots commentedon Jun 4, 2022
If you put in
ulimit -a, you should see something like this:If the values for
-d(data seg size),-m(resident set size), or especially-v(address space) are not "unlimited", that means you have a ulimit set and you're probably having the same issue I did.As to how to fix it, it'll be set in the shell files... somewhere. Maybe your
.profile,.bashrc, etc. Maybe the system version of the same. It depends on what shell you're running, what OS/distribution, etc.updpatch: element.io 1.12.25-1
updpatch: vaultwarden-web 2026.10.1-1