-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
src: keep main-thread Isolate attached to platform during Dispose #31795
src: keep main-thread Isolate attached to platform during Dispose #31795
Conversation
This works around a situation in which the V8 WASM code calls into the platform while the Isolate is being disposed. This goes against the V8 API constract for `v8::Platform`. In lieu of a proper fix, it should be okay to keep the Isolate registered; the race condition fixed by 25447d8 cannot occur for the `NodeMainInstance`’s Isolate, as it is the last one to exit in any given Node.js process. This partially reverts 25447d8. Refs: nodejs#30909 Refs: nodejs#31752
Please 👍 to fast-track this for inclusion in #31781 (v12.16.1). |
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.
LGTM as a temporary fix but I definitely worry about breaking the contract here. Do we know what the WASM edge cases are and is there a better way of working around those?
@jasnell I don’t have a full understanding of the situation yet. It looks like the WASM engine in V8 has its own, separate GC feature, that can also be triggered during My attempt to fix that would be basically to skip sending the task after
To be clear, my understanding is that V8 does that, not that we do that. |
Landed in e460f8c |
This works around a situation in which the V8 WASM code calls into the platform while the Isolate is being disposed. This goes against the V8 API constract for `v8::Platform`. In lieu of a proper fix, it should be okay to keep the Isolate registered; the race condition fixed by 25447d8 cannot occur for the `NodeMainInstance`’s Isolate, as it is the last one to exit in any given Node.js process. This partially reverts 25447d8. Refs: #30909 Refs: #31752 PR-URL: #31795 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This works around a situation in which the V8 WASM code calls into the platform while the Isolate is being disposed. This goes against the V8 API constract for `v8::Platform`. In lieu of a proper fix, it should be okay to keep the Isolate registered; the race condition fixed by 25447d8 cannot occur for the `NodeMainInstance`’s Isolate, as it is the last one to exit in any given Node.js process. This partially reverts 25447d8. Refs: #30909 Refs: #31752 PR-URL: #31795 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This works around a situation in which the V8 WASM code calls into the platform while the Isolate is being disposed. This goes against the V8 API constract for `v8::Platform`. In lieu of a proper fix, it should be okay to keep the Isolate registered; the race condition fixed by 25447d8 cannot occur for the `NodeMainInstance`’s Isolate, as it is the last one to exit in any given Node.js process. This partially reverts 25447d8. Refs: #30909 Refs: #31752 PR-URL: #31795 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Discard tasks silently that are posted when the Isolate is being disposed. It is not possible to avoid a race condition window between unregistering the Isolate with the platform and disposing it in which background tasks and the Isolate deinit steps themselves may lead to new tasks being posted. The only sensible action in that case is discarding the tasks. Fixes: nodejs#31752 Fixes: https://bugs.chromium.org/p/v8/issues/detail?id=10104 Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2061548 Refs: nodejs#31795 Refs: nodejs#30909
…pose" This reverts commit e460f8c. It is no longer necessary after the previous commit, and restores consistency of the call order between the main thread code, the other call sites, and the documentation. Refs: nodejs#31795
Discard tasks silently that are posted when the Isolate is being disposed. It is not possible to avoid a race condition window between unregistering the Isolate with the platform and disposing it in which background tasks and the Isolate deinit steps themselves may lead to new tasks being posted. The only sensible action in that case is discarding the tasks. Fixes: #31752 Fixes: https://bugs.chromium.org/p/v8/issues/detail?id=10104 Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2061548 Refs: #31795 Refs: #30909 PR-URL: #31853 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Discard tasks silently that are posted when the Isolate is being disposed. It is not possible to avoid a race condition window between unregistering the Isolate with the platform and disposing it in which background tasks and the Isolate deinit steps themselves may lead to new tasks being posted. The only sensible action in that case is discarding the tasks. Fixes: #31752 Fixes: https://bugs.chromium.org/p/v8/issues/detail?id=10104 Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2061548 Refs: #31795 Refs: #30909 PR-URL: #31853 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Discard tasks silently that are posted when the Isolate is being disposed. It is not possible to avoid a race condition window between unregistering the Isolate with the platform and disposing it in which background tasks and the Isolate deinit steps themselves may lead to new tasks being posted. The only sensible action in that case is discarding the tasks. Fixes: #31752 Fixes: https://bugs.chromium.org/p/v8/issues/detail?id=10104 Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2061548 Refs: #31795 Refs: #30909 PR-URL: #31853 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Discard tasks silently that are posted when the Isolate is being disposed. It is not possible to avoid a race condition window between unregistering the Isolate with the platform and disposing it in which background tasks and the Isolate deinit steps themselves may lead to new tasks being posted. The only sensible action in that case is discarding the tasks. Fixes: #31752 Fixes: https://bugs.chromium.org/p/v8/issues/detail?id=10104 Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2061548 Refs: #31795 Refs: #30909 PR-URL: #31853 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Discard tasks silently that are posted when the Isolate is being disposed. It is not possible to avoid a race condition window between unregistering the Isolate with the platform and disposing it in which background tasks and the Isolate deinit steps themselves may lead to new tasks being posted. The only sensible action in that case is discarding the tasks. Fixes: #31752 Fixes: https://bugs.chromium.org/p/v8/issues/detail?id=10104 Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2061548 Refs: #31795 Refs: #30909 PR-URL: #31853 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
…pose" This reverts commit e460f8c. It is no longer necessary after the previous commit, and restores consistency of the call order between the main thread code, the other call sites, and the documentation. Refs: nodejs#31795 PR-URL: nodejs#31853 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This works around a situation in which the V8 WASM code calls
into the platform while the Isolate is being disposed.
This goes against the V8 API constract for
v8::Platform
.In lieu of a proper fix, it should be okay to keep the Isolate
registered; the race condition fixed by 25447d8 cannot
occur for the
NodeMainInstance
’s Isolate, as it is the lastone to exit in any given Node.js process.
This partially reverts 25447d8.
Refs: #30909
Refs: #31752
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes