From 61b9ad573aafceafed790beb1c6e6b065911ecf0 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Mon, 26 Feb 2024 20:20:52 +0000 Subject: [PATCH] [shutdown] Add logs when shutdown is done --- src/core/lib/surface/init.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/lib/surface/init.cc b/src/core/lib/surface/init.cc index 25ba6fb97cf..276bf5600ee 100644 --- a/src/core/lib/surface/init.cc +++ b/src/core/lib/surface/init.cc @@ -136,8 +136,8 @@ void grpc_shutdown_internal_locked(void) g_shutting_down_cv->SignalAll(); } -void grpc_shutdown_internal(void* /*ignored*/) { - GRPC_API_TRACE("grpc_shutdown_internal", 0, ()); +void grpc_shutdown_from_cleanup_thread(void* /*ignored*/) { + GRPC_API_TRACE("grpc_shutdown_from_cleanup_thread", 0, ()); grpc_core::MutexLock lock(g_init_mu); // We have released lock from the shutdown thread and it is possible that // another grpc_init has been called, and do nothing if that is the case. @@ -145,6 +145,7 @@ void grpc_shutdown_internal(void* /*ignored*/) { return; } grpc_shutdown_internal_locked(); + gpr_log(GPR_DEBUG, "grpc_shutdown from cleanup thread done"); } void grpc_shutdown(void) { @@ -165,6 +166,7 @@ void grpc_shutdown(void) { gpr_log(GPR_DEBUG, "grpc_shutdown starts clean-up now"); g_shutting_down = true; grpc_shutdown_internal_locked(); + gpr_log(GPR_DEBUG, "grpc_shutdown done"); } else { // spawn a detached thread to do the actual clean up in case we are // currently in an executor thread. @@ -172,7 +174,7 @@ void grpc_shutdown(void) { g_initializations++; g_shutting_down = true; grpc_core::Thread cleanup_thread( - "grpc_shutdown", grpc_shutdown_internal, nullptr, nullptr, + "grpc_shutdown", grpc_shutdown_from_cleanup_thread, nullptr, nullptr, grpc_core::Thread::Options().set_joinable(false).set_tracked(false)); cleanup_thread.Start(); }