diff --git a/src/ray/core_worker/core_worker.cc b/src/ray/core_worker/core_worker.cc index af09bb383ed7..e186feb75595 100644 --- a/src/ray/core_worker/core_worker.cc +++ b/src/ray/core_worker/core_worker.cc @@ -785,8 +785,12 @@ void CoreWorker::Exit( detail = std::move(detail), creation_task_exception_pb_bytes]() { rpc::DrainServerCallExecutor(); - Disconnect(exit_type, detail, creation_task_exception_pb_bytes); KillChildProcs(); + // Disconnect should be put close to Shutdown + // https://github.com/ray-project/ray/pull/34883 + // TODO (iycheng) Improve the Process.h and make it able to monitor + // process liveness + Disconnect(exit_type, detail, creation_task_exception_pb_bytes); Shutdown(); }, "CoreWorker.Shutdown"); @@ -830,9 +834,13 @@ void CoreWorker::ForceExit(const rpc::WorkerExitType exit_type, const std::string &detail) { RAY_LOG(WARNING) << "Force exit the process. " << " Details: " << detail; - Disconnect(exit_type, detail); KillChildProcs(); + // Disconnect should be put close to Exit + // https://github.com/ray-project/ray/pull/34883 + // TODO (iycheng) Improve the Process.h and make it able to monitor + // process liveness + Disconnect(exit_type, detail); // NOTE(hchen): Use `QuickExit()` to force-exit this process without doing cleanup. // `exit()` will destruct static objects in an incorrect order, which will lead to