-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
OOM when importing CJS into ESM in a shared environment due to ulimits #42222
Comments
FYI: When I fork dotenv and added an ESM explicit export, I can get my ESM import in my original program to run fine in the shared environment (ulimit setting enabled). I guess until this is fixed in node I will resort to manual ESM conversion where possible... any updates from node team? |
The lexer is a WASM blob and V8 makes large reservations for WASM blobs. It doesn't use all that memory right away but it reserves it in case it needs to. It's by design, not a bug. The best advice I can give you is to remove the ulimit. |
Understood. Unfortunately one the server in question removing ulimits are not an option, so I will just avoid using any CJS imports as this is an intended feature by the lexer. Thanks for the reply |
update: thanks to guybedford's fix, this now works with node v18.60:
|
Version
14.16.1 (also on 16.14.0, 16.10.0, and more...)
Platform
Linux hebe 4.19.0-17-amd64 #1 SMP Debian 4.19.194-3 (2021-07-18) x86_64 GNU/Linux
Subsystem
cjs-module-lexer
What steps will reproduce the bug?
Running an ES6 module (
.mjs
) which imports a CJS module, in a shared environment (i.e. server with many users).ulimit
s :Note: dotenv is v16.0.0
Running
node break.mjs
will cause the error (see below for exact error).However, the CJS version is fine:
node break.cjs
has no issues when run.How often does it reproduce? Is there a required condition?
100% of the time, in this shared environment with the above mentioned ulimits.
I tried on my locla machine to set
ulimit
to10000000
and I can reproduce it (it wasunlimited
before, and worked fine).What is the expected behavior?
I would think it can import / run without running into this limit, seems to be 10GiB from ulimit?
What do you see instead?
Additional information
This works fine on my local machine, but the ulimit is different:
I think these are slightly related issues, but dont drill down that it is specifically being cause by importing CJS into ESM module due to ulimit constraints
#40201
cross-seed/cross-seed#178
The text was updated successfully, but these errors were encountered: