Skip to content

build: generate the Node startup snapshot once per build - #52902

Merged
codebytere merged 1 commit into
mainfrom
fix/node-snapshot-once-per-build
Aug 17, 2026
Merged

build: generate the Node startup snapshot once per build#52902
codebytere merged 1 commit into
mainfrom
fix/node-snapshot-once-per-build

Conversation

@codebytere

Copy link
Copy Markdown
Member

Description of Change

run_node_mksnapshot was defined in every toolchain that pulled in :node_snapshot, so a cross build ran it twice: once in the default toolchain for the shipped framework and once in v8_snapshot_toolchain for the host tool that generates the browser process's js2c code cache. Two runs aren't guaranteed to produce the same snapshot, and on Windows they don't, so the tool built its cache against a read-only heap the framework never embedded. V8 then rejected every entry at startup with a read-only snapshot checksum mismatch and the browser process compiled browser_init, utility_init and node_init from source instead - which is what the js2c build-time code cache specs caught on windows-arm64 (https://github.com/electron/electron/actions/runs/32001222846/job/95314127255).

This defines the action only in the default toolchain and has each toolchain's :node_snapshot compile that one output, so the snapshot the cache is keyed to is the snapshot the framework ships.

Checklist

Release Notes

Notes: none

run_node_mksnapshot was instantiated in every toolchain that pulled in
":node_snapshot", so a cross build ran it twice: once in the default
toolchain for the shipped framework, once in v8_snapshot_toolchain for the
host tool that generates the browser process's js2c code cache. Two runs
are not guaranteed to produce the same snapshot, and on Windows they do
not, so the tool built its cache against a read-only heap the framework
never embedded and V8 rejected every entry at startup with a read-only
snapshot checksum mismatch - the browser process compiled browser_init,
utility_init and node_init from source instead.

Define the action only in the default toolchain and have each toolchain's
":node_snapshot" compile that one output, so the snapshot the cache is
keyed to is the snapshot the framework ships.

Notes: none
@codebytere
codebytere requested a review from a team as a code owner August 17, 2026 10:27
@codebytere codebytere added semver/none target/42-x-y PR should also be added to the "42-x-y" branch. target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. labels Aug 17, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Aug 17, 2026
@codebytere codebytere changed the title fix: generate the Node startup snapshot once per build build: generate the Node startup snapshot once per build Aug 17, 2026
@codebytere codebytere removed the new-pr 🌱 PR opened recently label Aug 17, 2026
@codebytere
codebytere merged commit ee0811d into main Aug 17, 2026
140 of 141 checks passed
@release-clerk

release-clerk Bot commented Aug 17, 2026

Copy link
Copy Markdown

No Release Notes

@codebytere
codebytere deleted the fix/node-snapshot-once-per-build branch August 17, 2026 13:17
@trop

trop Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "44-x-y" cleanly;
you will need to perform this backport manually.

@trop trop Bot removed the target/44-x-y PR should also be added to the "44-x-y" branch. label Aug 17, 2026
@trop

trop Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "43-x-y" cleanly;
you will need to perform this backport manually.

@trop

trop Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "42-x-y" cleanly;
you will need to perform this backport manually.

@trop

trop Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

@MarshallOfSound has manually backported this PR to "43-x-y", please check out #52881

@trop

trop Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

@MarshallOfSound has manually backported this PR to "42-x-y", please check out #52880

@trop trop Bot added merged/44-x-y PR was merged to the "44-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/42-x-y PR was merged to the "42-x-y" branch. and removed in-flight/44-x-y in-flight/43-x-y in-flight/42-x-y labels Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

45-x-y merged/42-x-y PR was merged to the "42-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. no-backport semver/none

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants