Set NODE_OPTIONS to increase V8 heap for large monorepos#1649
Open
davidwinder-gyde wants to merge 3 commits intogithub:mainfrom
Open
Set NODE_OPTIONS to increase V8 heap for large monorepos#1649davidwinder-gyde wants to merge 3 commits intogithub:mainfrom
davidwinder-gyde wants to merge 3 commits intogithub:mainfrom
Conversation
The updater container has an 8GB memory limit (UPDATER_MAX_MEMORY), but Node.js V8 auto-scaling caps heap at ~2GB for containers above 4GB. This leaves ~6GB of allocated container memory unused while pnpm/npm crash with "JavaScript heap out of memory" on large monorepos (100+ workspace packages) during lockfile regeneration. Set NODE_OPTIONS=--max-old-space-size=4096 to allow V8 to use up to 4GB (half the container limit), leaving room for Ruby and other processes. Fixes: dependabot/dependabot-core#14596
Resolve merge conflict in dist/ caused by dependency updates (github#1647, github#1648) merged to main.
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.
Problem
The updater container has an 8GB memory limit (
UPDATER_MAX_MEMORY), but Node.js V8 auto-scaling caps heap at ~2GB for containers above 4GB. This leaves ~6GB of allocated container memory unused whilepnpm installcrashes with "JavaScript heap out of memory" on large monorepos during lockfile regeneration.This affects any pnpm/npm monorepo with 100+ workspace packages where the lockfile regeneration exceeds 2GB of heap. The failure is deterministic — the same dependency update fails every time with no workaround available to users.
Fix
Add
NODE_OPTIONS=--max-old-space-size=4096to theenvVarsarray inupdater-builder.ts. This allows V8 to use up to 4GB (half the container limit), leaving room for Ruby and other processes running in the container.Why this value
UPDATER_MAX_MEMORY)Testing
npm run lint-check— passesnpm run format-check— passesnpm run test— 121 passed, 17 skipped (same as main)npm run package— dist rebuilt and committedRelated