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 |
bnoordhuis
left a comment
There was a problem hiding this comment.
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 |
joyeecheung
left a comment
There was a problem hiding this comment.
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)
santigimeno
left a comment
There was a problem hiding this comment.
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.