Skip to content

sea: mount vfsArchive at layer 0 and in workers - #66709

Open
pipobscure wants to merge 2 commits into
nodejs:mainfrom
pipobscure:vfs-sea-workers
Open

pipobscure wants to merge 2 commits into
nodejs:mainfrom
pipobscure:vfs-sea-workers

Conversation

@pipobscure

Copy link
Copy Markdown
Contributor

Re-land of #66614, reverted in #66706 because it broke
parallel/test-bootstrap-modules when the test suite runs in worker mode.

The first commit is the original change, unchanged. The second commit fixes
the regression:

A worker required internal/vfs/sea just to ask whether the SEA has an
archive to mount. Every worker, SEA or not, therefore loaded that module and
internalBinding('sea') at startup. The answer is now recorded in C++ as an
internal [sea_vfs_archive] option, alongside [vfs_load_set], and a worker
requires internal/vfs/sea only when that option is set. This matches how the
--vfs-load mount is gated.

Verified locally:

  • tools/test.py --worker parallel/test-bootstrap-modules: failed before the fix, passes now.
  • test/sea/*vfs* and parallel/test-vfs* pass. The vfs-zip SEA test starts a worker from inside the archive.

Since the original PR landed despite this failure, please include
node-test-commit-custom-suites-freestyle in the CI run; that job catches it.

AI assistance was used. Every line was inspected by me personally.

A single executable application built with "vfsArchive" mounted its
archive at the next free layer, like any file system a program mounts
itself, and only in the main thread. A worker had no mount at all, so
a path into the archive, such as the main script's __filename, could
not be loaded there.

Mount the archive at the layer reserved for --vfs-load instead, so it
is at the same mount point in every thread, and mount it in each
worker as well, with the main script placed at its root just as in
the main thread. The worker reads the main script through a new
getMainCode() binding, since no main script is handed to it. Unlike
the --vfs-load source, the archive needs no provider that a preload
could register, so its mount in a worker is not deferred past
--import.

Since the archive takes that mount point, reject --vfs-load alongside
it: --build-sea refuses it in "execArgv", and the executable refuses it
at startup when it comes from --node-options or from the execArgv of a
worker.

Also fix the example in vfs.md, which showed a file system a program
mounts itself at layer 0, the layer reserved for these mounts.

Signed-off-by: Philipp Dunkel <pip@pipobscure.com>
A worker required internal/vfs/sea to ask whether the SEA has an
archive to mount, so every worker, in a SEA or not, loaded that module
and the sea binding at startup.

Record the answer in an internal [sea_vfs_archive] option instead,
alongside [vfs_load_set], and have a worker require internal/vfs/sea
only when it is set.

Signed-off-by: Philipp Dunkel <pip@pipobscure.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/config
  • @nodejs/single-executable

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Oct 13, 2026
@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.59459% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.48%. Comparing base (3f0c2e4) to head (af478ec).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/node_sea.cc 81.81% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #66709   +/-   ##
=======================================
  Coverage   90.48%   90.48%           
=======================================
  Files         791      791           
  Lines      277204   277258   +54     
  Branches    53309    53318    +9     
=======================================
+ Hits       250827   250879   +52     
  Misses      16789    16789           
- Partials     9588     9590    +2     
Files with missing lines Coverage Δ
lib/internal/main/embedding.js 91.80% <100.00%> (-0.09%) ⬇️
lib/internal/main/worker_thread.js 95.10% <100.00%> (+0.07%) ⬆️
lib/internal/vfs/sea.js 100.00% <100.00%> (ø)
src/node_options.cc 81.80% <100.00%> (+0.09%) ⬆️
src/node_options.h 95.67% <100.00%> (+0.01%) ⬆️
src/node_sea.h 100.00% <ø> (ø)
src/node_sea.cc 87.73% <81.81%> (-0.15%) ⬇️

... and 25 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 13, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 13, 2026
@nodejs-github-bot

This comment was marked as outdated.

@jasnell jasnell added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Oct 14, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants