From eb76065ad3068cc3002264b43800f8f4f30afeca Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Wed, 16 Oct 2024 15:57:58 +0200 Subject: [PATCH] ssh remoting: Fix hang when activity channel gets dropped (#19275) When the SSH command dies or the server, the channel gets dropped and the heartbeat method went into an infinite loop causing a hang. Oversight from yesterday. Fixed now. Release Notes: - N/A --- crates/remote/src/ssh_session.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/remote/src/ssh_session.rs b/crates/remote/src/ssh_session.rs index 4d13142549..ed4bbbefae 100644 --- a/crates/remote/src/ssh_session.rs +++ b/crates/remote/src/ssh_session.rs @@ -743,7 +743,11 @@ impl SshRemoteClient { loop { select_biased! { - _ = connection_activity_rx.next().fuse() => { + result = connection_activity_rx.next().fuse() => { + if result.is_none() { + log::warn!("ssh heartbeat: connection activity channel has been dropped. stopping."); + return Ok(()); + } keepalive_timer.set(cx.background_executor().timer(HEARTBEAT_INTERVAL).fuse()); } _ = keepalive_timer => {