vm: add experimental NodeRealm implementation#47855
Closed
mcollina wants to merge 30 commits into
Closed
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A NodeRealm is a complete Node.js environment that runs within the same thread. This feature is added behind a
--experimental-noderealmflag.This work is based on #45018, which adds the synchronous-worker module initially written by @addaleax. and is incorporated here with Anna's permission as stated in #45018 by @jasnell (listed as a co-author of this change). The main difference from the synchronous-worker module is that I removed all the "synchronous" parts: it's now impossible to spin the event loop manually.
The reason for including this inside Node.js instead of keeping it as a separate module is access to internal API that would make
stop()possible without crashing the process.This implementation still suffers from a few bugs that I would aim to solve before removing the experimental flags:
ShadowRealm(memory leak in shadow realmsΒ #47353);stop();--inspect-brkdue to an async_hooks issue).