From c279982c131c556ebd474f4ffa9fd6c096d13830 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 5 Jun 2024 15:10:56 +0200 Subject: [PATCH] fix: Improve debug messages in `zenoh-transport` (#1090) * fix: Improve debug messages for failing RX/TX tasks * fix: Improve debug message for `accept_link` timeout * chore: Fix `clippy::redundant_pattern_matching` error --- io/zenoh-transport/src/multicast/link.rs | 4 ++-- io/zenoh-transport/src/unicast/manager.rs | 8 ++++++-- io/zenoh-transport/src/unicast/universal/link.rs | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/io/zenoh-transport/src/multicast/link.rs b/io/zenoh-transport/src/multicast/link.rs index aede7ae1fb..193df5ca67 100644 --- a/io/zenoh-transport/src/multicast/link.rs +++ b/io/zenoh-transport/src/multicast/link.rs @@ -342,7 +342,7 @@ impl TransportLinkMulticastUniversal { ) .await; if let Err(e) = res { - tracing::debug!("{}", e); + tracing::debug!("TX task failed: {}", e); // Spawn a task to avoid a deadlock waiting for this same task // to finish in the close() joining its handle zenoh_runtime::ZRuntime::Net.spawn(async move { c_transport.delete().await }); @@ -378,7 +378,7 @@ impl TransportLinkMulticastUniversal { .await; c_signal.trigger(); if let Err(e) = res { - tracing::debug!("{}", e); + tracing::debug!("RX task failed: {}", e); // Spawn a task to avoid a deadlock waiting for this same task // to finish in the close() joining its handle zenoh_runtime::ZRuntime::Net.spawn(async move { c_transport.delete().await }); diff --git a/io/zenoh-transport/src/unicast/manager.rs b/io/zenoh-transport/src/unicast/manager.rs index 2cce7299b0..899887bea0 100644 --- a/io/zenoh-transport/src/unicast/manager.rs +++ b/io/zenoh-transport/src/unicast/manager.rs @@ -746,13 +746,17 @@ impl TransportManager { let c_manager = self.clone(); self.task_controller .spawn_with_rt(zenoh_runtime::ZRuntime::Acceptor, async move { - if let Err(e) = tokio::time::timeout( + if tokio::time::timeout( c_manager.config.unicast.accept_timeout, super::establishment::accept::accept_link(link, &c_manager), ) .await + .is_err() { - tracing::debug!("{}", e); + tracing::debug!( + "Failed to accept link before deadline ({}ms)", + c_manager.config.unicast.accept_timeout.as_millis() + ); } incoming_counter.fetch_sub(1, SeqCst); }); diff --git a/io/zenoh-transport/src/unicast/universal/link.rs b/io/zenoh-transport/src/unicast/universal/link.rs index 9a85ee9a46..44a12be4ac 100644 --- a/io/zenoh-transport/src/unicast/universal/link.rs +++ b/io/zenoh-transport/src/unicast/universal/link.rs @@ -97,7 +97,7 @@ impl TransportLinkUnicastUniversal { .await; if let Err(e) = res { - tracing::debug!("{}", e); + tracing::debug!("TX task failed: {}", e); // Spawn a task to avoid a deadlock waiting for this same task // to finish in the close() joining its handle // TODO(yuyuan): do more study to check which ZRuntime should be used or refine the @@ -125,7 +125,7 @@ impl TransportLinkUnicastUniversal { // TODO(yuyuan): improve this callback if let Err(e) = res { - tracing::debug!("{}", e); + tracing::debug!("RX task failed: {}", e); // Spawn a task to avoid a deadlock waiting for this same task // to finish in the close() joining its handle