Uh oh!
There was an error while loading. Please reload this page.
src: fix cb scope bugs involved in termination - #45596
Conversation
ywave620
commented
Dec 2, 2022
Any idea? :) |
legendecas
commented
Dec 6, 2022
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Dec 6, 2022
ywave620
commented
Dec 13, 2022
@legendecas Could you run the CI for this? |
nodejs-github-bot
commented
Dec 15, 2022
There was a problem hiding this comment.
The difference here between !env_->can_call_into_js() and env_->is_stopping() is trivial. Environment::can_call_into_js() also checks if Environment::is_stopping_ is set. Maybe @addaleax can chime in here?
If this line is updated, the lambda variable should also be renamed as perform_call_js_check or similar. Also, I'd find the checks if (!env_->can_call_into_js()) return; below can be merged with this lambda call too.
There was a problem hiding this comment.
Yeah, semantically, this should be checking for whether we’re currently stopping the current environment through a termination exception, so is_stopping() would seem to be the correct choice?
ywave620
commented
Feb 15, 2023
Any thoughts on this PR? |
legendecas
commented
Feb 16, 2023
Would you mind updating the PR according to addaleax's comment above? Thanks! |
ywave620
commented
Feb 20, 2023
@legendecas addaleax's suggestion does not fix the bug. Please see above for why. I suggest that remove Lines 637 to 639 in c203921 |
legendecas
commented
Feb 20, 2023
With #45907, |
Be more aggresive to clean up the async id stack, and ensure the cleanup when terminating. 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().
53f19ce to
af95ec8Compareywave620
commented
Feb 20, 2023
@legendecas Got you. Changed, PTAL |
nodejs-github-bot
commented
Feb 20, 2023
A test crashed. I wonder if there is a way to get a full stacktrace 🤔️ |
nodejs-github-bot
commented
Feb 22, 2023
legendecas
commented
Feb 22, 2023
According to the reliability report nodejs/reliability#503, the failed test doesn't seem to be introduced in this PR. I've resumed the build. |
ywave620
commented
Feb 25, 2023
@legendecas Could you merge this? |
nodejs-github-bot
commented
Feb 28, 2023
Landed in 7a37829 |
Be more aggresive to clean up the async id stack, and ensure the cleanup when terminating. 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(). PR-URL: #45596 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Be more aggresive to clean up the async id stack, and ensure the cleanup when terminating. 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(). PR-URL: #45596 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Be more aggresive to clean up the async id stack, and ensure the cleanup when terminating. 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(). PR-URL: #45596 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
An inheritor of #45422 and a fix to #43084. I move the original failing test back to the test/parallel/ to increase the chance that it exercises the defect, at which this PR is targeted.
To see the bug in 43084, apply this patch and run the script