CLI error: abort(RangeError: WebAssembly.instantiate(): Out of memory: wasm memory)
JeffersonQin opened this issue · 11 comments
Describe the bug
For whatever command and image I run through cli, I always get
- (node:41120) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 25 unpipe listeners added to [WriteStream]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
(node:41120) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 25 error listeners added to [WriteStream]. Use emitter.setMaxListeners() to increase limit
(node:41120) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 25 close listeners added to [WriteStream]. Use emitter.setMaxListeners() to increase limit
(node:41120) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 25 finish listeners added to [WriteStream]. Use emitter.setMaxListeners() to increase limit
0/1 \ ▐▨▨▨▨▨╌╌╌╌╌▌ Encoding (24 threads)
text-split.png: 462.15KBfailed to asynchronously prepare wasm: RangeError: WebAssembly.instantiate(): Out of memory: wasm memory
node:internal/process/promises:227
triggerUncaughtException(err, true /* fromPromise */);
^
[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "abort(RangeError: WebAssembly.instantiate(): Out of memory: wasm memory). Build with -s ASSERTIONS=1 for more info.".] {
code: 'ERR_UNHANDLED_REJECTION'
}
Version:
- OS w/ version: Windows 10 and WSL 1 Ubuntu 18.04
- Node version: 15.6.0
- npm version: 7.4.0
+1 on Ubuntu 20.04
I also encounter this on Ubuntu 20. A little more context; I was using https://github.com/webpack-contrib/image-minimizer-webpack-plugin with these options:
const ImageMinimizerPlugin = require("image-minimizer-webpack-plugin");
module.exports = {
module: {
rules: [
// You need this, if you are using `import file from "file.ext"`, for `new URL(...)` syntax you don't need it
{
test: /\.(jpe?g|png)$/i,
type: "asset",
},
],
},
optimization: {
minimizer: [
new ImageMinimizerPlugin({
minimizer: {
implementation: ImageMinimizerPlugin.squooshMinify,
options: {
encodeOptions: {
mozjpeg: {
// That setting might be close to lossless, but it’s not guaranteed
// https://github.com/GoogleChromeLabs/squoosh/issues/85
quality: 100,
},
webp: {
lossless: 1,
},
avif: {
// https://github.com/GoogleChromeLabs/squoosh/blob/dev/codecs/avif/enc/README.md
cqLevel: 0,
},
},
},
},
}),
],
},
};
The error encountered was:
failed to asynchronously prepare wasm: RangeError: WebAssembly.instantiate(): Out of memory: wasm memory
failed to asynchronously prepare wasm: RangeError: WebAssembly.instantiate(): Out of memory: wasm memory
node:internal/event_target:777
process.nextTick(() => { throw err; });
^
Error [RuntimeError]: abort(RangeError: WebAssembly.instantiate(): Out of memory: wasm memory). Build with -s ASSERTIONS=1 for more info.
at abort (/home/john/code/github/blog.johnnyreilly.com/blog-website/node_modules/@squoosh/lib/build/index.js:28:9428)
at /home/john/code/github/blog.johnnyreilly.com/blog-website/node_modules/@squoosh/lib/build/index.js:28:11293
Emitted 'error' event on Worker instance at:
I'm getting this same problem. The only version of node that squoosh runs seems to be 32bit v15.
Same error for me. Has anyone found a solution? I don't get this issue locally but I'm getting it on Circle CI
I got a same problem.
Environment:
nodejs-16.14.0-2.fc35.x86_64
Fedora 35 on WSL2 on Windows 10 build 19044.1645
I want to convert AVIF to PNG.
npx @squoosh/cli --oxipng '{"level":3,"interlace":false}' 00001.avif
Output;
⠋ (node:4275) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 33 unpipe listeners added to [WriteStream]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
(node:4275) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 33 error listeners added to [WriteStream]. Use emitter.setMaxListeners() to increase limit
(node:4275) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 33 close listeners added to [WriteStream]. Use emitter.setMaxListeners() to increase limit
(node:4275) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 33 finish listeners added to [WriteStream]. Use emitter.setMaxListeners() to increase limit
0/1 ⠋ ▐╌╌╌╌╌╌╌╌╌╌▌ Decoding...
node:internal/event_target:916
process.nextTick(() => { throw err; });
^
RangeError [Error]: WebAssembly.instantiate(): Out of memory: wasm memory
Emitted 'error' event on Worker instance at:
at Worker.[kOnErrorMessage] (node:internal/worker:289:10)
at Worker.[kOnMessage] (node:internal/worker:300:37)
at MessagePort.<anonymous> (node:internal/worker:201:57)
at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:647:20)
at MessagePort.exports.emitMessage (node:internal/per_context/messageport:23:28)
- 1 with the same problem on MacOs 12.3.1, node 16.15.0.
Hope your team can fix that <3
Similar problem here, I tested on 3 devices, but only get this problem on one of them.
OK devices are Ubuntu 20.04.4 LTS
and Ubuntu 22.04 LTS
, the device with the problem is Ubuntu 20.04.4 LTS
. All of them have the same node and npm versions node v16.15.1
and npm 8.13.2
.
The device with the problem is a 32 core/64 threads and 128GB of memory, I doubt that memory is an issue here, so I am wondering if that is just too many cores/threads and the app does not support it.
Unfortunately, due to a few people leaving the team, and staffing issues resulting from the current economic climate (ugh), the CLI and libsquoosh packages are no longer actively maintained. I know that sucks, but there simply isn't the time & people to work on this. If anyone from the community wants to fork it, you have my blessing. The squoosh.app web app will continue to be supported and improved.
@jakearchibald I'd suggest adding a note to the README letting people know this isn't maintained anymore.
The readmes of both packages in npm have already been updated with a notice.
The main part of the project (the web app) is still maintained.