-
Notifications
You must be signed in to change notification settings - Fork 29k
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
No call to SetIdle() when terminating #45422
Conversation
Calling SetIdle() when terminating is not harmless. When node terminates due to an unhandled exception, v8 preseves the vm state, which is JS and notifies node through PerIsolateMessageListener(). If node calls SetIdle() later, v8 complains because it requires the vm state to either be EXTERNEL or IDLE when embedder calling SetIdle().
24958ca
to
c0e3840
Compare
Welcome to join discussion about v8's behavior in https://bugs.chromium.org/p/v8/issues/detail?id=13464 |
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 with the caveat that this may end up swapping one bug for another, although it's probably a hypothetical scenario.
I'm thinking of when someone calls isolate->TerminateExecution()
, then later on calls isolate->CancelTerminateExecution()
.
Fix typo Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
use fixture function to check no abort
add assertion
fix judgment bug
Sry, the previous commits forgets to wrap an asserttion around |
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.
I think the changes here make sense with or without a fix in V8 to update the state to EXTERNAL before invoking the message listener (I think that should also be done - SetIdle()
might not be the only victim of it)
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. By the way, this will fix #41107
I have moved this change to #45596, which includes a fix to another bug about terminating. PTAL. |
Fix #45421, where you can find a helpful stack trace
One can argues that v8 is responsable for transfering vm state to EXTERNAL before invoking
PerIsolateMessageListener()
, if v8 agrees and changes for it, this issue is gone without any change of Node.js. However,SetIdle()
is basically for cpu profiling only, it's not necessary when terminating. Removing it is not harmful while otherwise will lead to crash before v8 makes that change.