fix(frontend): raise ng serve heap limit to avoid OOM on low-RAM machines#6914
Open
gupta-sahil01 wants to merge 1 commit into
Open
fix(frontend): raise ng serve heap limit to avoid OOM on low-RAM machines#6914gupta-sahil01 wants to merge 1 commit into
gupta-sahil01 wants to merge 1 commit into
Conversation
…ines The start script relied on Node's default V8 heap (~2.2 GB on 8 GB RAM), which ng serve exceeds during (re)builds and crashes with an out-of-memory error. Mirror the build script's --max-old-space-size=8192 so the dev server survives on lower-RAM machines. Closes apache#6859
Contributor
Automated Reviewer SuggestionsBased on the
|
aglinxinyuan
requested changes
Jul 27, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6914 +/- ##
=========================================
Coverage 78.70% 78.70%
Complexity 3740 3740
=========================================
Files 1161 1161
Lines 46084 46084
Branches 5110 5110
=========================================
Hits 36269 36269
Misses 8206 8206
Partials 1609 1609
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Jul 27, 2026
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 changes were proposed in this PR?
Root cause. The frontend
startscript runsng serveon Node's default V8 heap. Node auto-sizes that limit from available RAM — on an 8 GB machine it's only ~2.2 GB — andng serveexceeds it during a build, crashing withFATAL ERROR: Reached heap limit — JavaScript heap out of memory. Because the script usesconcurrently --kill-others, the crash also tears down the y-websocket process, and the dev server does not recover without a manual restart. Thebuildscript already passes--max-old-space-size=8192, so only the dev server was affected — an inconsistency between the two.Fix. Give
ng servethe same heap ceiling the production build already uses, by invoking Node directly on the CLI entry point (thengwrapper can't forward the flag):One-line change to
frontend/package.json. No effect on developers with 16 GB+ RAM (their default heap was already large enough, which is why this went unnoticed); it simply removes the crash on lower-RAM machines.Any related issues, documentation, discussions?
How was this PR tested?
Reproduced and verified on an 8 GB-RAM machine:
yarn start(→ng serve) crashed withReached heap limit — JavaScript heap out of memory, with V8 topping out around ~2040 MB. On this machine it failed on the initial build ("Generating browser application bundles"), not only on incremental rebuilds — so the dev server never even reached a serving state.yarn startcompiles to "Compiled successfully" and serveslocalhost:4200, and editing/saving a template no longer crashes it.No env-var workaround (
NODE_OPTIONS=--max-old-space-size=…) is needed anymore — the script carries the limit itself.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Anthropic Claude (Claude Code)