-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(swingset): don't un-expose 'gc', to stop intermittent test failures #6029
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just minor terminology ("symbol" -> "binding"), otherwise LGTM!
I figured out that the CI failure was another instance of #5575 (and I have an idea on how to deal with that), so I'll just re-kick the CI. |
// we leave --expose_gc turned on, otherwise AVA's shared workers | ||
// may race and disable it before we manage to extract the binding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we leave a comment that it's safe since at worse it would just leave a global gc
in new realms (which we don't create in non-test paths), and that would get removed in Compartments anyway.
10ce5d7
to
49131da
Compare
engine-gc.js acquires the `gc()` function (to force garbage collection) on Node.js by turning on the (global) `--expose_gc` V8 flag, then evaluating code within a new context (because the original one might not have had `--expose_gc` turned on), stashing the `gc` global, then uses `--no-expose_gc` to hide it again. It seems that AVA's worker-based parallelism approach causes multiple calls to this routine within the same process, sharing a V8 instance. So there's a race between one worker doing enable/stash/disable and another. If they interleave, a "stash" might happen while the symbol is disabled, causing a Reference Error and a crash. This won't cause `gc` to be visible to new Compartments, because SES strips out all globals that it doesn't recognize. closes #6028
49131da
to
c4f7038
Compare
engine-gc.js acquires the
gc()
function (to force garbagecollection) on Node.js by turning on the (global)
--expose_gc
V8flag, then evaluating code within a new context (because the original
one might not have had
--expose_gc
turned on), stashing thegc
global, then uses
--no-expose_gc
to hide it again.It seems that AVA's worker-based parallelism approach causes multiple
calls to this routine within the same process, sharing a V8
instance. So there's a race between one worker doing
enable/stash/disable and another. If they interleave, a "stash" might
happen while the symbol is disabled, causing a Reference Error and a
crash.
closes #6028