-
Notifications
You must be signed in to change notification settings - Fork 30k
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
timers: check can_call_into_js in Immediates #21057
timers: check can_call_into_js in Immediates #21057
Conversation
Do not execute native immediates and prevent infinite loop if it's possible to call into JS
src/env.cc
Outdated
@@ -457,7 +457,7 @@ void Environment::RunAndClearNativeImmediates() { | |||
void Environment::CheckImmediate(uv_check_t* handle) { | |||
Environment* env = Environment::from_immediate_check_handle(handle); | |||
|
|||
if (env->immediate_info()->count() == 0) | |||
if (env->immediate_info()->count() == 0 || !env->can_call_into_js()) |
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 this should be right before the do {
, because we probably want our native immediate callbacks to still be called – not all of them are calling JS, some or doing cleanup rather than something else
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.
Would that be strictly correct even if it's not calling JS? At least in relation to the main thread (and not workers), the expectation was that no user code would run after EmitExit
finishes. After RunCleanup
was added that's no longer the case since we run the loop one final time.
Are there are any Immediates that we truly want to have run at this point?
Landed in 5a6b197 |
Prevent an infinite loop if it's not possible to call into JS. PR-URL: #21057 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
Prevent an infinite loop if it's not possible to call into JS. PR-URL: #21057 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
Do not call into JS if it's not safe in Immediates and prevent a future infinite loop.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes