fix(#6990): reduce likelihood of libzip OOM in larger dependency graphs#7007
Open
redwheelbarrow wants to merge 3 commits intoyarnpkg:masterfrom
Open
fix(#6990): reduce likelihood of libzip OOM in larger dependency graphs#7007redwheelbarrow wants to merge 3 commits intoyarnpkg:masterfrom
redwheelbarrow wants to merge 3 commits intoyarnpkg:masterfrom
Conversation
added 2 commits
December 8, 2025 18:00
…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
redwheelbarrow
commented
Dec 9, 2025
|
|
||
| if (instance.reserved <= 0) { | ||
| instance.active = false; | ||
| this.instances[reservation.instanceIndex].instance = null; |
Author
There was a problem hiding this comment.
I'd like to believe the native WASM will get unloaded by being dereferenced, but I don't know.
Author
|
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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