Skip to content

Fix OOM during production webpack build#355

Open
upalatucci wants to merge 1 commit intoopenshift:mainfrom
upalatucci:fix-oom-build-main
Open

Fix OOM during production webpack build#355
upalatucci wants to merge 1 commit intoopenshift:mainfrom
upalatucci:fix-oom-build-main

Conversation

@upalatucci
Copy link
Contributor

@upalatucci upalatucci commented Feb 25, 2026

Summary

  • The CI images job can fail with SIGKILL (OOM kill) during the webpack production build because the process exceeds the container memory limit.
  • Set NODE_OPTIONS=--max-old-space-size=4096 in the build script, matching the pattern already used by the dev script (which sets 8192MB).

Test plan

  • CI images job should pass without OOM

Made with Cursor

Summary by CodeRabbit

  • Chores
    • Optimized build process configuration to improve stability and performance during compilation.

Set NODE_OPTIONS=--max-old-space-size=4096 for the build script to
prevent OOM kills in CI, matching the pattern already used by the dev
script.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

Walkthrough

The build script in package.json was updated to include a Node.js memory option (NODE_OPTIONS=--max-old-space-size=4096) alongside the existing NODE_ENV=production setting, enabling webpack builds to use up to 4GB of heap memory.

Changes

Cohort / File(s) Summary
Build Configuration
package.json
Modified build script to add NODE_OPTIONS=--max-old-space-size=4096 flag for increased Node.js memory allocation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Stable And Deterministic Test Names ❓ Inconclusive Unable to access repository structure and git information to assess test files for unstable or dynamic test names. Repository access is required to identify modified test files and evaluate test name stability.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix OOM during production webpack build' directly describes the main change: increasing Node.js memory allocation to resolve out-of-memory errors during the webpack production build, which matches the objective and the package.json modification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Test Structure And Quality ✅ Passed PR only modifies package.json build script; no test code changes present to evaluate against test quality requirements.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Line 9: The dev npm script currently scopes NODE_OPTIONS only to the rm
command because the env assignment precedes rm -rf dist; update the "dev" script
so NODE_OPTIONS is applied to the webpack serve invocation (the entire chain) by
moving the env assignment to prefix the npm run ts-node invocation (i.e., ensure
NODE_ENV=development and NODE_OPTIONS=--max-old-space-size=8192 are set for npm
run ts-node -- ./node_modules/.bin/webpack serve) or alternatively use a
cross-platform tool like cross-env to export NODE_OPTIONS for the webpack serve
process; modify the "dev" script string accordingly so the webpack/ts-node
process receives the 8192 MB heap limit.

ℹ️ Review info

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 86f180a and 87b1a4e.

📒 Files selected for processing (1)
  • package.json

@@ -7,7 +7,7 @@
"scripts": {
"clean": "rm -rf dist",
"dev": "NODE_ENV=development NODE_OPTIONS=--max-old-space-size=8192 rm -rf dist && npm run ts-node -- ./node_modules/.bin/webpack serve --progress",
Copy link

@coderabbitai coderabbitai bot Feb 25, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Pre-existing bug: NODE_OPTIONS in dev does not reach webpack.

NODE_ENV=development NODE_OPTIONS=--max-old-space-size=8192 rm -rf dist && npm run ts-node -- ...webpack serve

In POSIX shell, KEY=val cmd1 && cmd2 scopes the env var to cmd1 only. Here NODE_OPTIONS=--max-old-space-size=8192 is scoped to rm -rf dist (not a Node.js process) and is silently ignored; it never reaches the npm run ts-node invocation. The webpack serve process in dev has been running without the intended 8192 MB heap limit.

The fix mirrors the corrected pattern from line 10:

🐛 Proposed fix
-"dev": "NODE_ENV=development NODE_OPTIONS=--max-old-space-size=8192 rm -rf dist && npm run ts-node -- ./node_modules/.bin/webpack serve --progress",
+"dev": "rm -rf dist && NODE_ENV=development NODE_OPTIONS=--max-old-space-size=8192 npm run ts-node -- ./node_modules/.bin/webpack serve --progress",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"dev": "NODE_ENV=development NODE_OPTIONS=--max-old-space-size=8192 rm -rf dist && npm run ts-node -- ./node_modules/.bin/webpack serve --progress",
"dev": "rm -rf dist && NODE_ENV=development NODE_OPTIONS=--max-old-space-size=8192 npm run ts-node -- ./node_modules/.bin/webpack serve --progress",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 9, The dev npm script currently scopes NODE_OPTIONS
only to the rm command because the env assignment precedes rm -rf dist; update
the "dev" script so NODE_OPTIONS is applied to the webpack serve invocation (the
entire chain) by moving the env assignment to prefix the npm run ts-node
invocation (i.e., ensure NODE_ENV=development and
NODE_OPTIONS=--max-old-space-size=8192 are set for npm run ts-node --
./node_modules/.bin/webpack serve) or alternatively use a cross-platform tool
like cross-env to export NODE_OPTIONS for the webpack serve process; modify the
"dev" script string accordingly so the webpack/ts-node process receives the 8192
MB heap limit.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should change this to npm run clean && NODE_ENV=development NODE_OPTIONS=--max-old-space-size=8192 npm run ts-node -- ./node_modules/.bin/webpack serve --progress

Copy link

Choose a reason for hiding this comment

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

@adamviktora Excellent suggestion! Using npm run clean instead of rm -rf dist is indeed better because it:

  1. Maintains consistency with other scripts like build and build-dev which already use npm run clean
  2. Provides better abstraction – if the clean logic needs to change in the future, it only needs to be updated in one place
  3. Still fixes the NODE_OPTIONS scoping issue by placing the environment variables before the npm run ts-node invocation

Your proposed change properly ensures that both NODE_ENV and NODE_OPTIONS are scoped to the webpack serve process while keeping the script structure clean and maintainable.

@openshift-ci openshift-ci bot requested review from rszwajko and tnisan February 25, 2026 13:52
@openshift-ci
Copy link

openshift-ci bot commented Feb 25, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: upalatucci

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 25, 2026
@openshift-ci
Copy link

openshift-ci bot commented Feb 25, 2026

@upalatucci: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants