diff --git a/profiling/src/profiling/mod.rs b/profiling/src/profiling/mod.rs index 703091c634..e902937efd 100644 --- a/profiling/src/profiling/mod.rs +++ b/profiling/src/profiling/mod.rs @@ -836,23 +836,13 @@ impl Profiler { } } - fn join_collector_and_uploader(self, timeout: Duration) -> Result<(), JoinError> { - if self.should_join.load(Ordering::SeqCst) { - let result1 = thread_utils::join_timeout(self.time_collector_handle, timeout); - if let Err(err) = &result1 { - warn!("{err}, recent samples may be lost"); - } - - // Wait for the time_collector to join, since that will drop - // the sender half of the channel that the uploader is - // holding, allowing it to finish. - let result2 = thread_utils::join_timeout(self.uploader_handle, timeout); - if let Err(err) = &result2 { - warn!("{err}, recent samples are most likely lost"); - } - - let num_failures = result1.is_err() as usize + result2.is_err() as usize; - result2.and(result1).map_err(|_| JoinError { num_failures }) + fn join_collector_and_uploader(self, _timeout: Duration) -> Result<(), JoinError> { + let result1 = self.time_collector_handle.join(); + let result2 = self.uploader_handle.join(); + if result1.is_err() || result2.is_err() { + Err(JoinError { + num_failures: result1.is_err() as usize + result2.is_err() as usize, + }) } else { Ok(()) } diff --git a/profiling/src/profiling/thread_utils.rs b/profiling/src/profiling/thread_utils.rs index 66083f3972..d18be08dc0 100644 --- a/profiling/src/profiling/thread_utils.rs +++ b/profiling/src/profiling/thread_utils.rs @@ -50,6 +50,7 @@ where } } +#[allow(unused)] #[derive(thiserror::Error, Debug)] #[error("timeout of {timeout_ms} ms reached when joining thread {thread}")] pub struct TimeoutError { @@ -61,6 +62,7 @@ pub struct TimeoutError { /// Otherwise, it will leak the handle and return an error. /// # Panics /// If the thread being joined has panic'd, this will resume the panic. +#[allow(unused)] pub fn join_timeout(handle: JoinHandle<()>, timeout: Duration) -> Result<(), TimeoutError> { // After notifying the other threads, it's likely they'll need some time // to respond adequately. Joining on the JoinHandle is supposed to be the