Repository navigation
fix(docker): re-derive build memory budget from measured per-process RSS (#7518) - #11663
Merged
diegosouzapw merged 1 commit intoAug 26, 2026
Merged
Conversation
…RSS (#7518) PR #11419 lowered OMNIROUTE_BUILD_WORKERS 8->3 using an INFERRED per-worker peak (WORKER_PEAK_MB=2560) and treated the parent `next build` process's RSS as bounded by OMNIROUTE_BUILD_MEMORY_MB (the V8 heap ceiling). Both assumptions were wrong: the issue owner's own VPS reproduction (dmesg OOM-killer report) measured the real per-process RSS directly at ~4.5 GB, independent of NODE_OPTIONS, since Turbopack compiles in native/Rust memory outside the V8 heap -- and that applies to the parent process too. With OMNIROUTE_BUILD_WORKERS=3 (1 parent + 2 workers), the measured worst case is 3 x 4500MB = 13500MB against a 12288MB (75% of 16GB) budget -- still over, matching the still-live "Publish to Docker Hub" CI failures after #11419 merged (run 32907937950, 2026-08-25). Lowers OMNIROUTE_BUILD_WORKERS to 2 (1 parent + 1 worker = 9000MB, fits with headroom) and re-derives tests/unit/docker-build-memory-budget.test.ts's model on the measured figure, applied uniformly to every process instead of conflating the parent process with the V8 heap ceiling.
This was referenced Aug 26, 2026
Collaborator
Author
|
Validated in local merge-train (train tip a3a96af7308584900f0fab3ab4afd8499391230a, boarded #11663 #11664 #11665 #11667 #11668 #11669 #11670 #11678 on .113 /srv/omniroute-train) — typecheck:core, file-size, complexity, cognitive-complexity, changelog-integrity all GREEN. npm run test:unit showed 21 failures across 15 test files, none touching this PR's diff; reproduced identically (same test names, same asserts) on origin/release/v3.8.51 alone with zero PRs boarded (targeted re-run, 21/94 fail, same failure set) — confirmed base-red/environment-load drift per merge-gates.md §3, not introduced by any of the 8 boarded PRs. |
This was referenced Aug 26, 2026
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 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.
Refs #7518
Scope
This PR addresses only the residual, currently-live defect in #7518 — the Docker
build's memory budget model, not the original complaint (default branch / Docker Hub
image), which the owner's 2026-08-23 comment already confirmed is fixed and out of
scope here.
Root cause
tests/unit/docker-build-memory-budget.test.ts(added by PR #11419, merged2026-08-24) modeled the Docker build's worst-case memory as
heapMb + workers * WORKER_PEAK_MBwithWORKER_PEAK_MB = 2560— a value thetest's own comment labeled an inference ("7 workers didn't fit" → per-worker
peak "somewhere north of ~1.8 GB"), not a measurement. It also implicitly assumed
the parent
next buildprocess's RSS trackedOMNIROUTE_BUILD_MEMORY_MB(the V8heap ceiling).
The issue owner's own live VPS reproduction (2026-08-24 04:49 UTC) measured the
real number directly via
dmesg's OOM-killer report:next-build (v16) ... anon-rss:4522744kB(~4.5 GB) per process, independentof the
NODE_OPTIONS --max-old-space-sizeV8 heap ceiling — Turbopack itself isnative/Rust and compiles outside the V8 heap, and the figure applies to the
parent process too, not just workers.
Recomputing the budget with the measured ~4.5 GB/process figure against the
current default (
OMNIROUTE_BUILD_WORKERS=3, i.e. 1 parent + 2 workers) gives aworst case of
3 * 4500 = 13500 MB, which exceeds the12288 MB(75% of a 16 GBGitHub Actions runner) budget — exactly matching the still-live "Publish to
Docker Hub" failures (
cannot allocate memoryat "Collecting page data using 2workers") even after #11419 merged.
Fix
Dockerfile'sARG OMNIROUTE_BUILD_WORKERSdefault3 -> 2(1 parent +1 worker = 2 processes × 4.5 GB = 9 GB, fits the 12.288 GB budget with headroom).
tests/unit/docker-build-memory-budget.test.ts's budget model on themeasured ~4.5 GB/process figure, applied uniformly to every process (parent +
workers) instead of conflating the parent process with the V8 heap ceiling.
docs/guides/DOCKER_GUIDE.md's build-arg table with the correcteddefault and the measured-RSS rationale.
Dockerfile.bun: its builder stage runsbun run --quiet builddirectly with no
OMNIROUTE_BUILD_WORKERS/CIRCLE_NODE_TOTALwiring, so theworker-pool pattern this issue is about does not apply there — no change needed.
Regression test (TDD, Hard Rule #18)
Re-confirmed RED against the unfixed code with a repro test using the plan-file's
exact model (measured RSS applied per-process, including the parent):
After the fix,
tests/unit/docker-build-memory-budget.test.ts(re-derived on themeasured figure, now the permanent regression guard) passes GREEN:
All 8 sibling Dockerfile-touching test files (docker-base-path-patch,
docker-ensure-base-path, docker-healthcheck-3151, docker-healthcheck-base-path,
docker-llmlingua-optionals-9166, dockerfile-base-path-arg,
dockerfile-better-sqlite3-node-gyp-6700, dockerfile-build-heap-4076,
dockerfile-dashboard-embed-arg-10273, dockerfile-npm-bundled-cve-patch,
tls-client-node-docker-binary-7802) still pass: 41/41.
Gates run
node scripts/check/check-file-size.mjs— OKnode scripts/check/check-changelog-integrity.mjs— OKnode scripts/check/check-docs-sync.mjs— PASSnpx eslint --suppressions-location config/quality/eslint-suppressions.json tests/unit/docker-build-memory-budget.test.ts— clean, exit 0node scripts/check/check-complexity.mjs/check-cognitive-complexity.mjs— scan onlysrc/,open-sse/,electron/,bin/; this diff touches none of those paths, so these gates are structurally unaffectednpm run typecheck:core— the changed file is not intsconfig.typecheck-core.json's curated file list; the test file itself type-checks cleanly undertsx(it ran successfully vianode --import tsx/esm --test)Remaining follow-up (not in this PR)
Per the plan-file's own checklist: after merging, watch the next few real
"Publish to Docker Hub" runs on the default release branch to confirm the OOM is
actually gone in production CI (not just the unit-test budget model, which has
now under-predicted reality twice), then comment on #7518 with the run links
before considering it durably closed.