Skip to content

Conversation

apapirovski
Copy link
Contributor

@apapirovski apapirovski commented May 31, 2018

Do not call into JS if it's not safe in Immediates and prevent a future infinite loop.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Do not execute native immediates and prevent infinite loop if it's
possible to call into JS
@apapirovski apapirovski added c++ Issues and PRs that require attention from people who are familiar with C++. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. labels May 31, 2018
@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label May 31, 2018
src/env.cc Outdated
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())
Copy link
Member

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

Copy link
Contributor Author

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?

@apapirovski
Copy link
Contributor Author

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 1, 2018
@apapirovski
Copy link
Contributor Author

Landed in 5a6b197

@apapirovski apapirovski closed this Jun 4, 2018
@apapirovski apapirovski deleted the patch-skip-immediates-on-exit branch June 4, 2018 07:22
apapirovski added a commit that referenced this pull request Jun 4, 2018
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]>
MylesBorins pushed a commit that referenced this pull request Jun 6, 2018
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]>
@MylesBorins MylesBorins mentioned this pull request Jun 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants