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
fix: perform microtask checkpoint before MicrotaskRunner
destruction
#38828
base: main
Are you sure you want to change the base?
fix: perform microtask checkpoint before MicrotaskRunner
destruction
#38828
Conversation
Looks like this change needs some work; it introduces a regression in
|
4172fca
to
cf48ad7
Compare
MicrotaskRunner
destruction
I like the change in this PR, however I am wondering if the following was also considered. Currently we drain pending macro tasks on the uv loop when the
|
@deepak1556 there are some contexts where we don't have a MicrotaskRunner (for ex. NodeMain) - are you suggesting we move the |
I am suggesting to move |
Description of Change
Fix a bug that caused periodic test failures. Sample failure:
The problem seems to be that the test spawned this script which wrote to stderr immediately before exiting and it was possible for there to still be pending queued tasks when NodeService destroyed the microtask runner.
The approach extracts the tell-v8-to-perform-a-checkpoint code from
MicrotaskRunner::DidProcessTask()
into a new public convenience functionMicrotaskRunner::PerformCheckpoint()
. It calls that function fromJavascriptEnvironment::DestroyMicrotaskRunner()
before destroying the microtask runner.In
main
I'm able to trigger this test failure about 50% of the time. In this branch I wasn't able to break it in 100 iterations.CC @deepak1556 who has done a lot of work in this code in #24131 and #34980 and @codebytere's CallbackScope code in #27001
Checklist
npm test
passesRelease Notes
Notes: Fixed bug that could fail to process pending microtasks added to a child process immediately before calling
process.exit()
.