summaryrefslogtreecommitdiff
path: root/src/node_platform.cc
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-09-17 13:52:12 +0200
committerRich Trott <rtrott@gmail.com>2019-09-22 17:00:43 -0700
commit54c4139efd6a2063c5c20d5483935cd2ad4946fd (patch)
treeb7383adc3a6fbee931219aff0f10251cea1ce5e5 /src/node_platform.cc
parentab9b8e73eb1d664c0959e361478f47a546bda223 (diff)
downloadnode-new-54c4139efd6a2063c5c20d5483935cd2ad4946fd.tar.gz
src: discard remaining foreground tasks on platform shutdown
While V8 itself should not have any remaining tasks on the queue during platform shutdown, our inspector implementation may do so. Thus, the checks verifying that no tasks are queued at that point make some of the inspector tasks flaky. Remove the checks and replace them by explicitly destroying all tasks that are left. Refs: https://github.com/nodejs/node/pull/25653 Refs: https://github.com/nodejs/node/pull/28870#issuecomment-531908090 PR-URL: https://github.com/nodejs/node/pull/29587 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Diffstat (limited to 'src/node_platform.cc')
-rw-r--r--src/node_platform.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/node_platform.cc b/src/node_platform.cc
index b2e8d77ec7..f726382171 100644
--- a/src/node_platform.cc
+++ b/src/node_platform.cc
@@ -279,8 +279,13 @@ void PerIsolatePlatformData::Shutdown() {
if (flush_tasks_ == nullptr)
return;
- CHECK_NULL(foreground_delayed_tasks_.Pop());
- CHECK_NULL(foreground_tasks_.Pop());
+ // While there should be no V8 tasks in the queues at this point, it is
+ // possible that Node.js-internal tasks from e.g. the inspector are still
+ // lying around. We clear these queues and ignore the return value,
+ // effectively deleting the tasks instead of running them.
+ foreground_delayed_tasks_.PopAll();
+ foreground_tasks_.PopAll();
+
CancelPendingDelayedTasks();
ShutdownCbList* copy = new ShutdownCbList(std::move(shutdown_callbacks_));