From a593fde606139c3ffa07cd3e56e48b874f539a3f Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Tue, 12 May 2020 20:06:04 +0800 Subject: [PATCH] Fix core dumps in ExitActor (#8382) --- src/ray/core_worker/core_worker.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ray/core_worker/core_worker.cc b/src/ray/core_worker/core_worker.cc index 26316036d..97b8327d4 100644 --- a/src/ray/core_worker/core_worker.cc +++ b/src/ray/core_worker/core_worker.cc @@ -1917,7 +1917,10 @@ void CoreWorker::HandleCancelTask(const rpc::CancelTaskRequest &request, if (options_.log_dir != "") { RayLog::ShutDownRayLog(); } - exit(1); + // NOTE(hchen): Use `_Exit()` to force-exit this process without doing cleanup. + // `exit()` will destruct static objects in an incorrect order, which will lead to + // core dumps. + _Exit(1); } } @@ -1953,7 +1956,10 @@ void CoreWorker::HandleKillActor(const rpc::KillActorRequest &request, if (options_.log_dir != "") { RayLog::ShutDownRayLog(); } - exit(1); + // NOTE(hchen): Use `_Exit()` to force-exit this process without doing cleanup. + // `exit()` will destruct static objects in an incorrect order, which will lead to + // core dumps. + _Exit(1); } else { Exit(/*intentional=*/true); }