Skip to content

Commit 6f8ef2c

Browse files
addaleaxBridgeAR
authored andcommitted
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: #25653 Refs: #28870 (comment) PR-URL: #29587 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Eugene Ostroukhov <[email protected]> Reviewed-By: Minwoo Jung <[email protected]>
1 parent edaa2ee commit 6f8ef2c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/node_platform.cc

+7-2
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,13 @@ void PerIsolatePlatformData::Shutdown() {
279279
if (flush_tasks_ == nullptr)
280280
return;
281281

282-
CHECK_NULL(foreground_delayed_tasks_.Pop());
283-
CHECK_NULL(foreground_tasks_.Pop());
282+
// While there should be no V8 tasks in the queues at this point, it is
283+
// possible that Node.js-internal tasks from e.g. the inspector are still
284+
// lying around. We clear these queues and ignore the return value,
285+
// effectively deleting the tasks instead of running them.
286+
foreground_delayed_tasks_.PopAll();
287+
foreground_tasks_.PopAll();
288+
284289
CancelPendingDelayedTasks();
285290

286291
ShutdownCbList* copy = new ShutdownCbList(std::move(shutdown_callbacks_));

0 commit comments

Comments
 (0)