Skip to content

build: fix stale embedded.cc after mksnapshot relink - #67672

Open
ShenHongFei wants to merge 1 commit into
nodejs:mainfrom
ShenHongFei:embedded-cc-incremental-fix
Open

ShenHongFei wants to merge 1 commit into
nodejs:mainfrom
ShenHongFei:embedded-cc-incremental-fix

Conversation

@ShenHongFei

Copy link
Copy Markdown
Contributor

Background. After updating my local node/V8 sources, my Windows build died in node_mksnapshot: exit code 0x80000003, no output at all. Simply running the build again succeeded, so it looked like a flaky crash.

Root cause. MSBuild's CustomBuild target evaluates the up-to-dateness of all items before running any of them, and the check does not cascade between items. On the first build after mksnapshot.exe is relinked, run_mksnapshot regenerates embedded.S, but asm_to_inline_asm still sees the old embedded.S matching the old embedded.cc and is skipped. v8_snapshot then compiles a fresh snapshot.cc against a stale embedded.cc; when V8 sources changed, node_mksnapshot dies on a silent release-mode CHECK (release V8 crashes via __debugbreak() without printing, hence 0x80000003 with no output). The next build regenerates embedded.cc and "self-heals". So every first build after a mksnapshot relink hits this window; it only crashes when the sources actually changed, which is what made it look flaky.

Fix. Add mksnapshot.exe to the inputs of asm_to_inline_asm so both actions are always considered out of date together, and pass the converter arguments explicitly instead of expanding <@(_inputs)>.

Verified on Windows x64: before the change, touching mksnapshot.exe and rebuilding skipped the conversion step (no "generating: embedded.cc" line in the build log); with the change, both generation steps run in the same build and the full vcbuild build succeeds.

I used an AI coding assistant to diagnose this and draft the change; I reviewed the diff and verified it myself with local builds.

MSBuild evaluates CustomBuild items up-to-dateness before running any,
without cascading: after a mksnapshot relink, embedded.S is regenerated
but its conversion to embedded.cc is skipped, pairing a fresh
snapshot.cc with a stale embedded.cc. Track mksnapshot.exe as an input
and pass converter arguments explicitly.

Signed-off-by: ShenHongFei <shen.hongfei@qq.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/v8-update

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. v8 engine Issues and PRs related to the V8 dependency. labels Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. v8 engine Issues and PRs related to the V8 dependency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants