Skip to content

fix(build): bake --max-old-space-size=4096 into compiled full binaries - #3811

Merged
kojiwakayama merged 2 commits into
mainfrom
fix/inbox-269-compile-v8-flags
Aug 17, 2026
Merged

fix(build): bake --max-old-space-size=4096 into compiled full binaries#3811
kojiwakayama merged 2 commits into
mainfrom
fix/inbox-269-compile-v8-flags

Conversation

@kojiwakayama

Copy link
Copy Markdown
Contributor

Problem

Compiled binaries ignore the DENO_V8_FLAGS environment variable at runtime, so setting --max-old-space-size=4096 in the deployment environment never reaches a compiled release binary. A deployment can verifiably set the env var while the process still runs at V8's ~2 GiB default old-space limit and OOMs there.

deno compile --v8-flags is the only channel through which a compiled artifact receives V8 flags: they are serialized into the binary's trailer at compile time and are final (a runtime DENO_V8_FLAGS cannot override them).

Fix

  • Bake --max-old-space-size=4096 into the full profile via --v8-flags in createCompileArgs (scripts/build/compile-binary.ts). The baked value is the real production heap ceiling; production pods are sized (5 Gi limit) around it.
  • The proxy profile deliberately keeps V8's defaults: proxy pods run under a 1536 MiB cgroup limit (pinned by smoke-proxy-memory.sh), and a 4 GiB old-space ceiling would turn GC back-pressure into OOMKills.
  • Extend the post-compile artifact assertion to fail the build when the baked flags are missing from the trailer. The marker is anchored to the tail of the trailer's "v8_flags":[...] array (joined baked flags plus the closing ]), so an embedded source file that merely contains the quoted flag literal cannot satisfy the check vacuously. Checked on the artifact bytes because release builds cross-compile targets CI cannot execute.

Tests

scripts/build/compile-binary.test.ts:

  • Full profile emits --v8-flags=--max-old-space-size=4096; proxy profile emits no --v8-flags.
  • Mechanism leg: a probe compiled with a 3000 MB sentinel reports heap_size_limit in the 3000–3256 MB window even with a conflicting runtime DENO_V8_FLAGS — V8 defaults land near ~2 GiB or ~4 GiB, never ~3 GiB, so the observed limit can only come from the baked flag.
  • Wiring leg: a probe compiled with exactly the release profile's --v8-flags args serializes the flag into the trailer, verified through the same guard the build uses; this doubles as the empirical proof that the tail-anchored marker matches a real artifact on the pinned Deno line.

Verified locally on Deno 2.7.12 (CI pins the same 2.7 line).

Ref: veryfront-issue-inbox#269

Compiled binaries ignore DENO_V8_FLAGS at runtime, so the production
chart's --max-old-space-size=4096 never reached the release binary:
all 19 heap OOMs over 30 days died at V8's ~2 GiB default while the
manifest verifiably set 4096 (veryfront-issue-inbox#269).

deno compile --v8-flags serializes the flags into the binary trailer,
which is the only channel a compiled artifact gets them through. Bake
the 4096 MB old-space limit into the full profile, keep the proxy
profile on V8 defaults (proxy pods run under a 1536 MiB cgroup limit),
and extend the post-compile artifact assertion to fail the build when
the flag is missing from the trailer -- checked on the artifact bytes
because release builds cross-compile targets CI cannot execute.

Verified on the pinned Deno line: a probe compiled with a 3000 MB
sentinel reports heap_size_limit 3096 MB regardless of runtime
DENO_V8_FLAGS, while the same probe compiled the old way stays at the
host default.
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

📦 Client bundle boundary

Entrypoint Modules Source size Server leaks
src/index.client.ts 325 1937 KiB ✅ 0

A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in scripts/lint/client-bundle-baseline.json to burn down.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kojiwakayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Limit details: You’ve used all 1 included review currently available under your plan.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 159e5a6a-7ff5-4ba8-b5d6-134fe52ac423

📥 Commits

Reviewing files that changed from the base of the PR and between 2ff88bd and 1fc88c1.

📒 Files selected for processing (2)
  • scripts/build/compile-binary.test.ts
  • scripts/build/compile-binary.ts

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a398ac7db

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/build/compile-binary.ts Outdated
The artifact guard's failure message wrote an internal tracker reference
into CI logs. veryfront-code is a public repository, so those Actions
logs are publicly readable, and the identifier points at a private repo.
Every issue reference elsewhere in src/ lives in a comment; none is
emitted in message text. Keep the message's actionable half -- compiled
binaries ignore DENO_V8_FLAGS, so a missing baked flag means the ~2 GiB
default heap -- and drop the identifier, which tells a build-failure
reader nothing they can act on.
@kojiwakayama
kojiwakayama added this pull request to the merge queue Aug 17, 2026
@kojiwakayama

Copy link
Copy Markdown
Contributor Author

@codex review

Please review exact head 1fc88c102 before merge.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 1fc88c102d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Merged via the queue into main with commit eeb117e Aug 17, 2026
34 checks passed
@kojiwakayama
kojiwakayama deleted the fix/inbox-269-compile-v8-flags branch August 17, 2026 07:17
@kojiwakayama kojiwakayama mentioned this pull request Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant