mirror of
https://github.com/wassname/ray.git
synced 2026-07-18 12:40:56 +08:00
[Core] Show_webui segfault fix. (#8323)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user