GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — sea: mount the SEA VFS in workers at layer 0 by manusingh090 · Pull Request #67239 · nodejs/node Conversation
Contributor
Fixes: #67223 A single executable application built with #66709 already mounts the VFS in workers when it is backed by
For a VFS mounted with Tests:
Verified locally on Linux x64 (Ubuntu 24.04, GCC 13):
I could not test on Windows, where the original report comes from. AI assistance was used; I have reviewed the change and run the tests above.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
I'm not entirely sure this is the totally right approach. That being said, I'm also not entirely sure that's a bad thing. 😄 If anything I'm wondering whether I'll be looking at this in detail during the coming week. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for picking this up, and for the worker test in the SEA fixture: it tests exactly what #67223 is about, so please keep it. Having looked at this in detail, I think the fix should go one step further and put the SEA VFS at layer 0, whatever serves it, instead of reserving layer 1 for assets. Why layer 0
Whether the SEA uses
In In a worker's Once |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
4894f33 to
24aa85a
Compare
There was an error while loading. Please reload this page.
|
@pipobscure Thanks for the detailed review, that makes sense. Treating I've updated the PR:
One question: I took "every SEA" literally, so I squashed everything into one commit. I've only tested on Linux so far, so if someone can try it on Windows (where the original issue showed up), that would be great. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Yeah, I don't think allowing it makes sense as generally if you create an SEA, you want to control over what's run, so enabling this is like an escape-hatch which is risky. I'll ping a few other people this week to go over this as well and give it another review as well. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Thanks, I’ll wait for the other reviews |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @mcollina let's have a look at this one on Tuesday
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Can you rebase on the latest main please, then I can approve that and get it in. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## main #67239 +/- ## ========================================== + Coverage 90.73% 90.74% +0.01% ========================================== Files 798 798 Lines 280076 280117 +41 Branches 53880 53892 +12 ========================================== + Hits 254123 254190 +67 + Misses 16259 16215 -44 - Partials 9694 9712 +18
🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
A single executable application built with "useVfs" mounted the VFS serving its "assets" in the main thread only, at a mount point numbered in mount order, so a worker started from a script among the assets could not load it. On Windows this failed as an invalid package.json at \.\nul\package.json, because paths under the NUL device open it. "useVfs" is the --vfs-load of a single executable application: its "assets" or its "vfsArchive" archive are the source, and its "main" is the entry point. Mount it at layer 0, the mount point reserved for the --vfs-load source, whichever provider serves it, and mount it in workers too, as was already done for an archive. Other mounts are numbered from 1, as everywhere else. To keep layer 0 free, reject --vfs-load in every single executable application rather than only in one built with "vfsArchive": its entry point is fixed, and resolving modules against its files is what "useVfs" already does. --build-sea refuses it in "execArgv", and the executable at startup when it comes from --node-options or from the execArgv of a worker. A worker started from a path into a VFS that is not mounted in it, such as one mounted with vfs.mount() in its parent, now fails with ERR_VFS_NOT_MOUNTED. Fixes: nodejs#67223 Assisted-by: a coding agent Signed-off-by: Manjeet Singh <[email protected]>
Remove two comments in EnvironmentOptions::CheckOptions() that repeat what the code and the error message already say, and move the note that --vfs-load cannot be used in a single executable application out of the "Worker threads" section, since it applies to every SEA. Refs: nodejs#67223 Assisted-by: a coding agent Signed-off-by: Manjeet Singh <[email protected]>
3dcd62c to
77c4ffb
Compare
There was an error while loading. Please reload this page.
|
@pipobscure Rebased on the latest main. mcollina's compile cache change (#66768) touched the same code, so I adjusted it to fit this PR:
All SEA, VFS, worker and compile cache tests pass locally (Linux). @mcollina the rebase made your approval stale. Could you take another look? The only changes since your review are the rebase and the compile cache adjustments above. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Landed in 1b99d7c |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
A single executable application built with "useVfs" mounted the VFS serving its "assets" in the main thread only, at a mount point numbered in mount order, so a worker started from a script among the assets could not load it. On Windows this failed as an invalid package.json at \.\nul\package.json, because paths under the NUL device open it. "useVfs" is the --vfs-load of a single executable application: its "assets" or its "vfsArchive" archive are the source, and its "main" is the entry point. Mount it at layer 0, the mount point reserved for the --vfs-load source, whichever provider serves it, and mount it in workers too, as was already done for an archive. Other mounts are numbered from 1, as everywhere else. To keep layer 0 free, reject --vfs-load in every single executable application rather than only in one built with "vfsArchive": its entry point is fixed, and resolving modules against its files is what "useVfs" already does. --build-sea refuses it in "execArgv", and the executable at startup when it comes from --node-options or from the execArgv of a worker. A worker started from a path into a VFS that is not mounted in it, such as one mounted with vfs.mount() in its parent, now fails with ERR_VFS_NOT_MOUNTED. Fixes: #67223 Assisted-by: a coding agent Signed-off-by: Manjeet Singh <[email protected]> PR-URL: #67239 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Philipp Dunkel <[email protected]>
A single executable application built with "useVfs" mounted the VFS serving its "assets" in the main thread only, at a mount point numbered in mount order, so a worker started from a script among the assets could not load it. On Windows this failed as an invalid package.json at \.\nul\package.json, because paths under the NUL device open it. "useVfs" is the --vfs-load of a single executable application: its "assets" or its "vfsArchive" archive are the source, and its "main" is the entry point. Mount it at layer 0, the mount point reserved for the --vfs-load source, whichever provider serves it, and mount it in workers too, as was already done for an archive. Other mounts are numbered from 1, as everywhere else. To keep layer 0 free, reject --vfs-load in every single executable application rather than only in one built with "vfsArchive": its entry point is fixed, and resolving modules against its files is what "useVfs" already does. --build-sea refuses it in "execArgv", and the executable at startup when it comes from --node-options or from the execArgv of a worker. A worker started from a path into a VFS that is not mounted in it, such as one mounted with vfs.mount() in its parent, now fails with ERR_VFS_NOT_MOUNTED. Fixes: nodejs#67223 Assisted-by: a coding agent Signed-off-by: Manjeet Singh <[email protected]> PR-URL: nodejs#67239 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Philipp Dunkel <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
VFS breaking node:worker_modules
There was an error while loading. Please reload this page.