From ba93ef272317c697b3eb3e2202c6d7453ce2e5f8 Mon Sep 17 00:00:00 2001 From: Cameron Esfahani Date: Tue, 2 Apr 2024 11:43:59 -0500 Subject: [PATCH 1/2] Fix zombie ssh processes from accumulating --- gix-transport/src/client/blocking_io/file.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gix-transport/src/client/blocking_io/file.rs b/gix-transport/src/client/blocking_io/file.rs index 5106e407ad3..5f5bf25b0db 100644 --- a/gix-transport/src/client/blocking_io/file.rs +++ b/gix-transport/src/client/blocking_io/file.rs @@ -126,6 +126,18 @@ impl client::TransportWithoutIO for SpawnProcessOnDemand { } } +impl Drop for SpawnProcessOnDemand { + fn drop(&mut self) { + if let Some(mut child) = self.child.take() { + // The child process (e.g. `ssh`) may still be running at this point, so kill it before joining/waiting. + // In the happy-path case, it should have already exited gracefully, but in error cases or if the user + // interrupted the operation, it will likely still be running. + child.kill().ok(); + child.wait().ok(); + } + } +} + struct ReadStdoutFailOnError { recv: std::sync::mpsc::Receiver, read: std::process::ChildStdout, From 6118c5c35ff70a44bade7d054b628409606139ab Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 3 Apr 2024 21:42:56 +0200 Subject: [PATCH 2/2] fix: update `h2` to 0.4.4` to avoid RUSTSEC-2024-0332 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 52878592a24..23ad26be6b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2890,9 +2890,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51ee2dd2e4f378392eeff5d51618cd9a63166a2513846bbc55f21cfacd9199d4" +checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" dependencies = [ "bytes", "fnv",