From a77aef4f21f6fa25534b63d3c7d7150799f549f8 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Fri, 23 Aug 2024 10:36:03 +0900 Subject: [PATCH] Add debug log --- cpp/src/arrow/testing/process.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cpp/src/arrow/testing/process.cc b/cpp/src/arrow/testing/process.cc index a2ecd83769dd6..542d434935031 100644 --- a/cpp/src/arrow/testing/process.cc +++ b/cpp/src/arrow/testing/process.cc @@ -218,11 +218,18 @@ class Process::Impl { boost::system::error_code error_code; if (process_ && process_->running(error_code)) { process_->request_exit(error_code); - auto timeout = std::chrono::seconds(10); - std::chrono::time_point end = + if (!error_code) { + auto timeout = std::chrono::seconds(10); + std::chrono::time_point end = std::chrono::steady_clock::now() + timeout; - while (process_->running(error_code) && std::chrono::steady_clock::now() < end) { - std::this_thread::sleep_for(std::chrono::milliseconds(20)); + int i = 0; + while (process_->running(error_code) && std::chrono::steady_clock::now() < end) { + std::cerr << "(waiting terminated: " << i++ << ")" << std::endl; + std::this_thread::sleep_for(std::chrono::milliseconds(20)); + } + if (!process_->running(error_code)) { + std::cerr << "(failed graceful shutdown)" << std::endl; + } } } #else