From 75f7b24a18497570581e8a38d6349a7fd2027d68 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 5 Jun 2024 13:35:49 +0200 Subject: [PATCH 1/3] fix: Improve debug messages for failing RX/TX tasks --- io/zenoh-transport/src/multicast/link.rs | 4 ++-- io/zenoh-transport/src/unicast/universal/link.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 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/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 From 93b40afaf332bca283bbeee11582d4e0240a7068 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 5 Jun 2024 13:36:48 +0200 Subject: [PATCH 2/3] fix: Improve debug message for `accept_link` timeout --- io/zenoh-transport/src/unicast/manager.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/io/zenoh-transport/src/unicast/manager.rs b/io/zenoh-transport/src/unicast/manager.rs index 2cce7299b0..169ee0f14c 100644 --- a/io/zenoh-transport/src/unicast/manager.rs +++ b/io/zenoh-transport/src/unicast/manager.rs @@ -746,13 +746,16 @@ 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 let Err(_) = tokio::time::timeout( c_manager.config.unicast.accept_timeout, super::establishment::accept::accept_link(link, &c_manager), ) .await { - 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); }); From ba33d99f4735f5bee54e8086f1943c7de29d4a5e Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 5 Jun 2024 13:42:38 +0200 Subject: [PATCH 3/3] chore: Fix `clippy::redundant_pattern_matching` error --- io/zenoh-transport/src/unicast/manager.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/io/zenoh-transport/src/unicast/manager.rs b/io/zenoh-transport/src/unicast/manager.rs index 169ee0f14c..899887bea0 100644 --- a/io/zenoh-transport/src/unicast/manager.rs +++ b/io/zenoh-transport/src/unicast/manager.rs @@ -746,11 +746,12 @@ impl TransportManager { let c_manager = self.clone(); self.task_controller .spawn_with_rt(zenoh_runtime::ZRuntime::Acceptor, async move { - if let Err(_) = 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!( "Failed to accept link before deadline ({}ms)",