-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(#6990): reduce likelihood of libzip OOM in larger dependency graphs #7007
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
base: master
Are you sure you want to change the base?
Conversation
…pkg#6990) ## Summary Reduce the likelihood of large dependencies causing OOM crashes during install ## Problem Zip files are all loaded into WASM memory during pnp/pnpm install. The WASM libzip memory is limited to 2gigs. If there are many dependencies, or a few large ones, the limit will be reached and the runtime will crash. ## Solution Track the estimated memory usage per LibzipImpl, provide the current WASM or a new WASM depending on memory usage estimate. Cleanup WASMs that are no longer needed. ## Changes - Create WASM factory that tracks estimated heap usage in WASM - Construct new WASM for use by a LibzipImpl if heap usage is near max - Cleanup WASM upon discard ## Testing - Unit tests - Manually verified the reported issue yarnpkg#6990 is gone
|
|
||
| if (instance.reserved <= 0) { | ||
| instance.active = false; | ||
| this.instances[reservation.instanceIndex].instance = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to believe the native WASM will get unloaded by being dereferenced, but I don't know.
|
The problem is the WASM runs out of memory once the size of dependencies gets too large. It's maxed out at 2gigs and there's only a singleton instance. Other solutions:
|
| } | ||
|
|
||
| /** | ||
| * Remove the reservation's instance if the previous one has enough space, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to fix doc
What's the problem this PR addresses?
Addresses issue #6990 - Reduces the likelihood of large dependencies causing OOM crashes during install
Zip files are all loaded into WASM memory during pnp/pnpm install. The WASM libzip memory is limited to 2gigs. If there are many dependencies, or a few large ones, the limit will be reached and the runtime will crash.
How did you fix it?
Create WASM factory that tracks estimated heap usage in WASM
Construct new WASM for use by a LibzipImpl if heap usage is near max
Cleanup WASM upon discard
Checklist