Uh oh!
There was an error while loading. Please reload this page.
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
c0e3840Compareywave620
commented
Nov 11, 2022
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().
Uh oh!
There was an error while loading. Please reload this page.
Fix typo Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
nodejs-github-bot
commented
Nov 15, 2022
Uh oh!
There was an error while loading. Please reload this page.
use fixture function to check no abort
nodejs-github-bot
commented
Nov 16, 2022
add assertion
fix judgment bug
ywave620
commented
Nov 16, 2022
Sry, the previous commits forgets to wrap an asserttion around |
nodejs-github-bot
commented
Nov 16, 2022
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
nodejs-github-bot
commented
Nov 21, 2022
ywave620
commented
Nov 23, 2022
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.