Permalink
Browse files

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

PR-URL: #25653
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information...
hammacher authored and addaleax committed Jan 22, 2019
1 parent 34bc69d commit b113332daf1147ffe58597f1087c04a7e35c420b
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/node_platform.cc
@@ -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_),

0 comments on commit b113332

Please sign in to comment.