Skip to content

Commit

Permalink
src: ensure no more platform foreground tasks after Deinit
Browse files Browse the repository at this point in the history
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

PR-URL: #25653
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
backes authored and addaleax committed Jan 28, 2019
1 parent 34bc69d commit b113332
Showing 1 changed file with 2 additions and 1 deletion.
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

0 comments on commit b113332

Please sign in to comment.