Skip to content

fix: let custom V8 snapshots reach the main process again - #52872

Merged
MarshallOfSound merged 1 commit into
mainfrom
pr/custom-v8-snapshot-main-process
Aug 17, 2026
Merged

fix: let custom V8 snapshots reach the main process again#52872
MarshallOfSound merged 1 commit into
mainfrom
pr/custom-v8-snapshot-main-process

Conversation

@codebytere

Copy link
Copy Markdown
Member

Description of Change

Since the main process started booting from the embedded Node.js startup snapshot (#51703), its context is deserialized from that blob, which is built on top of the stock snapshot_blob.bin at build time. Anything a custom snapshot puts into the default context — electron-mksnapshot users, and the browser_v8_context_snapshot.bin that the loadBrowserProcessSpecificV8Snapshot fuse selects — therefore never showed up in the main process on native-built targets (mac arm64, linux x64, win x64), while cross-built targets, which ship without the Node snapshot, kept working. spec/fixtures/snapshot-items-available reproduces it (ReferenceError: f is not defined), but CI has only been running verify-mksnapshot.py --create-snapshot-only since the GHA migration, so nothing noticed.

This:

  • skips the embedded Node snapshot for the main process when the fuse is on or the loaded v8 context snapshot is not the one this build shipped, and bootstraps Node from scratch on the loaded blob as snapshot-less builds do. The check is a size + V8-blob-header comparison against constants that build/checksum_header.py now emits next to the existing SHA-256, so there is no hashing at startup;
  • re-adds the full verify-mksnapshot.py run (create the custom blobs and launch Electron with them) to one native test leg (linux x64);
  • documents in fuses.md that a custom snapshot means the main process gives up the startup snapshot's boot-time win.

Verified locally on linux x64: verify-mksnapshot.py end-to-end goes from not ok … f is not defined to ok successfully used custom snapshot, and a stock build still boots the main process from the embedded snapshot.

Checklist

Release Notes

Notes: Fixed custom V8 snapshots (electron-mksnapshot, and the loadBrowserProcessSpecificV8Snapshot fuse) having no effect in the main process on macOS arm64, Linux x64 and Windows x64.

Since the main process started booting from the embedded Node.js startup
snapshot (#51703), its context is deserialized from that blob, which was
built on top of the stock snapshot_blob.bin at build time. Objects a
custom snapshot puts into the default context -- electron-mksnapshot
users, and the browser_v8_context_snapshot.bin the
loadBrowserProcessSpecificV8Snapshot fuse selects -- therefore never
showed up in the main process on native builds (mac arm64, linux x64,
win x64), while cross-built targets, which ship without the Node
snapshot, kept working. spec/fixtures/snapshot-items-available ("f is
not defined") reproduces it, but CI only ran verify-mksnapshot.py with
--create-snapshot-only since the GHA migration.

Skip the embedded Node snapshot for the main process when the fuse is on
or the loaded v8 context snapshot is not the one this build shipped, and
bootstrap Node from scratch on the loaded blob as snapshot-less builds
do. The check is a size + V8-blob-header comparison against constants
that build/checksum_header.py now emits next to the existing SHA-256, so
it costs nothing at startup. Re-add the full verify-mksnapshot.py run to
one native test leg (linux x64).
@codebytere codebytere added semver/patch backwards-compatible bug fixes 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 16, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Aug 16, 2026
@MarshallOfSound
MarshallOfSound merged commit 11b7555 into main Aug 17, 2026
132 checks passed
@MarshallOfSound
MarshallOfSound deleted the pr/custom-v8-snapshot-main-process branch August 17, 2026 00:34
@release-clerk

release-clerk Bot commented Aug 17, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed custom V8 snapshots (electron-mksnapshot, and the loadBrowserProcessSpecificV8Snapshot fuse) having no effect in the main process on macOS arm64, Linux x64 and Windows x64.

@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 removed the target/43-x-y PR should also be added to the "43-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 "42-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 "44-x-y" cleanly;
you will need to perform this backport manually.

@trop trop Bot added needs-manual-bp/42-x-y needs-manual-bp/44-x-y and removed target/42-x-y PR should also be added to the "42-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. labels Aug 17, 2026
@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 #52876

@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 #52877

@trop

trop Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

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

MarshallOfSound added a commit that referenced this pull request Aug 17, 2026
…52876)

fix: let custom V8 snapshots reach the main process again (#52872)

Since the main process started booting from the embedded Node.js startup
snapshot (#51703), its context is deserialized from that blob, which was
built on top of the stock snapshot_blob.bin at build time. Objects a
custom snapshot puts into the default context -- electron-mksnapshot
users, and the browser_v8_context_snapshot.bin the
loadBrowserProcessSpecificV8Snapshot fuse selects -- therefore never
showed up in the main process on native builds (mac arm64, linux x64,
win x64), while cross-built targets, which ship without the Node
snapshot, kept working. spec/fixtures/snapshot-items-available ("f is
not defined") reproduces it, but CI only ran verify-mksnapshot.py with
--create-snapshot-only since the GHA migration.

Skip the embedded Node snapshot for the main process when the fuse is on
or the loaded v8 context snapshot is not the one this build shipped, and
bootstrap Node from scratch on the loaded blob as snapshot-less builds
do. The check is a size + V8-blob-header comparison against constants
that build/checksum_header.py now emits next to the existing SHA-256, so
it costs nothing at startup. Re-add the full verify-mksnapshot.py run to
one native test leg (linux x64).

(cherry picked from commit 11b7555)
@trop trop Bot added merged/42-x-y PR was merged to the "42-x-y" branch. and removed in-flight/42-x-y labels Aug 17, 2026
MarshallOfSound added a commit that referenced this pull request Aug 17, 2026
…52877)

fix: let custom V8 snapshots reach the main process again (#52872)

Since the main process started booting from the embedded Node.js startup
snapshot (#51703), its context is deserialized from that blob, which was
built on top of the stock snapshot_blob.bin at build time. Objects a
custom snapshot puts into the default context -- electron-mksnapshot
users, and the browser_v8_context_snapshot.bin the
loadBrowserProcessSpecificV8Snapshot fuse selects -- therefore never
showed up in the main process on native builds (mac arm64, linux x64,
win x64), while cross-built targets, which ship without the Node
snapshot, kept working. spec/fixtures/snapshot-items-available ("f is
not defined") reproduces it, but CI only ran verify-mksnapshot.py with
--create-snapshot-only since the GHA migration.

Skip the embedded Node snapshot for the main process when the fuse is on
or the loaded v8 context snapshot is not the one this build shipped, and
bootstrap Node from scratch on the loaded blob as snapshot-less builds
do. The check is a size + V8-blob-header comparison against constants
that build/checksum_header.py now emits next to the existing SHA-256, so
it costs nothing at startup. Re-add the full verify-mksnapshot.py run to
one native test leg (linux x64).

(cherry picked from commit 11b7555)
@trop trop Bot added merged/43-x-y PR was merged to the "43-x-y" branch. and removed in-flight/43-x-y labels Aug 17, 2026
MarshallOfSound added a commit that referenced this pull request Aug 17, 2026
…52878)

fix: let custom V8 snapshots reach the main process again (#52872)

Since the main process started booting from the embedded Node.js startup
snapshot (#51703), its context is deserialized from that blob, which was
built on top of the stock snapshot_blob.bin at build time. Objects a
custom snapshot puts into the default context -- electron-mksnapshot
users, and the browser_v8_context_snapshot.bin the
loadBrowserProcessSpecificV8Snapshot fuse selects -- therefore never
showed up in the main process on native builds (mac arm64, linux x64,
win x64), while cross-built targets, which ship without the Node
snapshot, kept working. spec/fixtures/snapshot-items-available ("f is
not defined") reproduces it, but CI only ran verify-mksnapshot.py with
--create-snapshot-only since the GHA migration.

Skip the embedded Node snapshot for the main process when the fuse is on
or the loaded v8 context snapshot is not the one this build shipped, and
bootstrap Node from scratch on the loaded blob as snapshot-less builds
do. The check is a size + V8-blob-header comparison against constants
that build/checksum_header.py now emits next to the existing SHA-256, so
it costs nothing at startup. Re-add the full verify-mksnapshot.py run to
one native test leg (linux x64).

(cherry picked from commit 11b7555)
@trop trop Bot added merged/44-x-y PR was merged to the "44-x-y" branch. and removed in-flight/44-x-y labels Aug 17, 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. new-pr 🌱 PR opened recently semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants