[Core] Show_webui segfault fix. (#8323)

This commit is contained in:
SangBin Cho
2020-05-06 11:45:07 -05:00
committed by GitHub
parent 04813c2ef5
commit e631827a9f
6 changed files with 35 additions and 3 deletions
+7
View File
@@ -590,6 +590,13 @@ void CoreWorker::WaitForShutdown() {
}
if (options_.worker_type == WorkerType::WORKER) {
RAY_CHECK(task_execution_service_.stopped());
// Asyncio coroutines could still run after CoreWorker is removed because it is
// running in a different thread. This can cause segfault because coroutines try to
// access CoreWorker methods that are already garbage collected. We should complete
// all coroutines before shutting down in order to prevent this.
if (worker_context_.CurrentActorIsAsync()) {
options_.terminate_asyncio_thread();
}
}
}
+2
View File
@@ -114,6 +114,8 @@ struct CoreWorkerOptions {
bool is_local_mode;
/// The number of workers to be started in the current process.
int num_workers;
/// The function to destroy asyncio event and loops.
std::function<void()> terminate_asyncio_thread;
};
/// Lifecycle management of one or more `CoreWorker` instances in a process.