Skip to content
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

src: ensure no more platform foreground tasks after Deinit #25653

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
src: ensure no more platform foreground tasks after Deinit
Node first calls `Isolate::Dispose`, then
`NodePlatform::UnregisterIsolate`.
This again calls `PerIsolatePlatformData::Shutdown`, which (before this
patch) called `FlushForegroundTasksInternal`, which might call
`RunForegroundTask` if it finds foreground tasks to be executed. This
will fail however, since `Isolate::GetCurrent` was already reset during
`Isolate::Dispose`.
Hence remove the check to `FlushForegroundTasksInternal` and add checks
instead that no more foreground tasks are scheduled.

Refs: v8#86
  • Loading branch information
backes authored and addaleax committed Jan 23, 2019
commit e2282ffb012c9d8c2bb07a1c90ef90dcfd7dc70b
3 changes: 2 additions & 1 deletion src/node_platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ void PerIsolatePlatformData::Shutdown() {
if (flush_tasks_ == nullptr)
return;

while (FlushForegroundTasksInternal()) {}
CHECK_NULL(foreground_delayed_tasks_.Pop());
CHECK_NULL(foreground_tasks_.Pop());
CancelPendingDelayedTasks();

uv_close(reinterpret_cast<uv_handle_t*>(flush_tasks_),
Expand Down