diff --git a/src/node_platform.cc b/src/node_platform.cc index 380a26ecb4bab6..713051efc3fc7a 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -244,14 +244,22 @@ void PerIsolatePlatformData::PostIdleTask(std::unique_ptr task) { } void PerIsolatePlatformData::PostTask(std::unique_ptr task) { - CHECK_NOT_NULL(flush_tasks_); + if (flush_tasks_ == nullptr) { + // V8 may post tasks during Isolate disposal. In that case, the only + // sensible path forward is to discard the task. + return; + } foreground_tasks_.Push(std::move(task)); uv_async_send(flush_tasks_); } void PerIsolatePlatformData::PostDelayedTask( std::unique_ptr task, double delay_in_seconds) { - CHECK_NOT_NULL(flush_tasks_); + if (flush_tasks_ == nullptr) { + // V8 may post tasks during Isolate disposal. In that case, the only + // sensible path forward is to discard the task. + return; + } std::unique_ptr delayed(new DelayedTask()); delayed->task = std::move(task); delayed->platform_data = shared_from_this();