From ebafc3835f53da9c9f75b130b6ddd77012353d0b Mon Sep 17 00:00:00 2001 From: Alexander Jiang Date: Thu, 9 Jan 2025 21:38:39 +0000 Subject: [PATCH] add list of components that failed to shut down in time to panic msg --- src/topology/running.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/topology/running.rs b/src/topology/running.rs index f0f0a40537ff8..4248c205d85a6 100644 --- a/src/topology/running.rs +++ b/src/topology/running.rs @@ -152,7 +152,7 @@ impl RunningTopology { components = ?remaining_components, "Failed to gracefully shut down in time. Killing components." ); - Result::Err(()) + Result::Err(remaining_components) }) as future::BoxFuture<'static, Result<(), ()>> } else { Box::pin(future::pending()) as future::BoxFuture<'static, Result<(), ()>> @@ -195,18 +195,18 @@ impl RunningTopology { // Aggregate future that ends once anything detects that all tasks have shutdown. let shutdown_complete_future = future::select_all(vec![ - Box::pin(timeout) as future::BoxFuture<'static, Result<(), ()>>, - Box::pin(reporter.map(|()| Result::<(), ()>::Ok(()))) as future::BoxFuture<'static, Result<(), ()>>, - Box::pin(success) as future::BoxFuture<'static, Result<(), ()>>, + Box::pin(timeout) as future::BoxFuture<'static, Result<(), String>>, + Box::pin(reporter.map(|()| Result::<(), String>::Ok(()))) as future::BoxFuture<'static, Result<(), String>>, + Box::pin(success) as future::BoxFuture<'static, Result<(), String>>, ]); // Now kick off the shutdown process by shutting down the sources. - let source_shutdown_complete = self.shutdown_coordinator.shutdown_all(deadline).map(|_| Result::<(), ()>::Ok(())); + let source_shutdown_complete = self.shutdown_coordinator.shutdown_all(deadline).map(|_| Result::<(), String>::Ok(())); // Panic to ensure that Vector returns a non-zero exit code when it's unable to gracefully shutdown futures::future::join(source_shutdown_complete, shutdown_complete_future) .map(|futures| match futures.1.0 { - Result::Err(_) => panic!("failed to gracefully shutdown in time, panic to force non-zero exit code"), + Result::Err(s) => panic!(format!("failed to gracefully shutdown in time, panic to force non-zero exit code: {s}")), Result::Ok(_) => (), }) }