Skip to content

fix(frontend): raise ng serve heap limit to avoid OOM on low-RAM machines - #6914

Merged
xuang7 merged 3 commits into
apache:mainfrom
gupta-sahil01:fix/ng-serve-heap-oom
Jul 30, 2026
Merged

fix(frontend): raise ng serve heap limit to avoid OOM on low-RAM machines#6914
xuang7 merged 3 commits into
apache:mainfrom
gupta-sahil01:fix/ng-serve-heap-oom

Conversation

@gupta-sahil01

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Root cause. The frontend start script runs ng serve on Node's default V8 heap. Node auto-sizes that limit from available RAM — on an 8 GB machine it's only ~2.2 GB — and ng serve exceeds it during a build, crashing with FATAL ERROR: Reached heap limit — JavaScript heap out of memory. Because the script uses concurrently --kill-others, the crash also tears down the y-websocket process, and the dev server does not recover without a manual restart. The build script already passes --max-old-space-size=8192, so only the dev server was affected — an inconsistency between the two.

Fix. Give ng serve the same heap ceiling the production build already uses, by invoking Node directly on the CLI entry point (the ng wrapper 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:

  • Before: yarn start (→ ng serve) crashed with Reached 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.
  • After: with the heap flag, yarn start compiles to "Compiled successfully" and serves localhost: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)

…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
@github-actions github-actions Bot added dependencies Pull requests that update a dependency file fix frontend Changes related to the frontend GUI labels Jul 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • No candidates found from git blame history.

@chenlica
chenlica requested a review from aglinxinyuan July 27, 2026 06:14
Comment thread frontend/package.json
@codecov-commenter

codecov-commenter commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.55%. Comparing base (06f8e42) to head (da17aef).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6914      +/-   ##
============================================
- Coverage     78.98%   75.55%   -3.43%     
+ Complexity     3785     3676     -109     
============================================
  Files          1160     1163       +3     
  Lines         46105    49664    +3559     
  Branches       5115     5933     +818     
============================================
+ Hits          36414    37525    +1111     
- Misses         8069    10437    +2368     
- Partials       1622     1702      +80     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from ebc78fd
agent-service 76.76% <ø> (ø) Carriedforward from ebc78fd
amber 70.85% <ø> (-1.33%) ⬇️ Carriedforward from ebc78fd
computing-unit-managing-service 20.49% <ø> (ø) Carriedforward from ebc78fd
config-service 66.66% <ø> (ø) Carriedforward from ebc78fd
file-service 67.21% <ø> (ø) Carriedforward from ebc78fd
frontend 76.58% <ø> (-6.42%) ⬇️
notebook-migration-service 78.94% <ø> (ø) Carriedforward from ebc78fd
pyamber 92.45% <ø> (-2.94%) ⬇️ Carriedforward from ebc78fd
workflow-compiling-service 55.14% <ø> (+28.83%) ⬆️ Carriedforward from ebc78fd

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aglinxinyuan aglinxinyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Jul 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jul 27, 2026
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Jul 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 27, 2026
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Jul 28, 2026
@aglinxinyuan
aglinxinyuan removed this pull request from the merge queue due to a manual request Jul 28, 2026
@aglinxinyuan aglinxinyuan added the release/v1.2 back porting to release/v1.2 label Jul 28, 2026
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Jul 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 28, 2026
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Jul 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 28, 2026
@xuang7
xuang7 added this pull request to the merge queue Jul 30, 2026
Merged via the queue into apache:main with commit 2ec3b0a Jul 30, 2026
33 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Backport to release/v1.2 failed. See job log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file fix frontend Changes related to the frontend GUI release/v1.2 back porting to release/v1.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Frontend dev server (ng serve) crashes with "JavaScript heap out of memory" on rebuild for lower-RAM machines

5 participants