Skip to content

Commit 089a707

Browse files
committed
fix(container-runner): fix leaked pipes
1 parent 7855096 commit 089a707

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

packages/edge/infra/client/container-runner/src/container.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,22 @@ pub fn run(
8484
//
8585
// This will wait for the child to exit and then exit itself so we have time to ship all of the
8686
// required logs
87-
let mut signals = Signals::new(&[SIGTERM])?;
88-
thread::spawn(move || {
89-
for _ in signals.forever() {
90-
println!("Received SIGTERM, forwarding to runc container {actor_id}");
91-
let status = Command::new("runc")
92-
.arg("kill")
93-
.arg("--all")
94-
.arg(&actor_id)
95-
.arg("SIGTERM")
96-
.status();
97-
println!("runc kill status: {:?}", status);
98-
break;
99-
}
100-
});
87+
//let mut signals = Signals::new(&[SIGTERM])?;
88+
//thread::spawn(move || {
89+
// for _ in signals.forever() {
90+
// println!("Received SIGTERM, forwarding to runc container {actor_id}");
91+
// let status = Command::new("runc")
92+
// .arg("kill")
93+
// .arg("--all")
94+
// .arg(&actor_id)
95+
// .arg("SIGTERM")
96+
// .stdout(Stdio::null())
97+
// .stderr(Stdio::null())
98+
// .status();
99+
// println!("runc kill status: {:?}", status);
100+
// break;
101+
// }
102+
//});
101103

102104
// Ship stdout & stderr logs
103105
let stdout_handle = ship_logs(msg_tx.clone(), log_shipper::StreamType::StdOut, runc_stdout);

packages/edge/infra/client/container-runner/tests/common/setup.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ impl Setup {
2424
pub fn signal_child(&self, signal: &str) {
2525
let kill = Command::new("kill")
2626
.args(["-s", signal, &self.child.id().to_string()])
27+
.stdout(std::process::Stdio::null())
28+
.stderr(std::process::Stdio::null())
2729
.status()
2830
.unwrap();
2931
assert!(kill.success());
@@ -37,6 +39,8 @@ impl Drop for Setup {
3739
.arg("delete")
3840
.arg("--force")
3941
.arg(&self.actor_id)
42+
.stdout(std::process::Stdio::null())
43+
.stderr(std::process::Stdio::null())
4044
.status()
4145
.unwrap();
4246

@@ -64,6 +68,8 @@ pub fn setup(command: &str) -> Setup {
6468
.arg("docker://debian:12.4")
6569
.arg("oci:oci-image:latest")
6670
.current_dir(actor_dir.path())
71+
.stdout(std::process::Stdio::null())
72+
.stderr(std::process::Stdio::null())
6773
.status()
6874
.unwrap();
6975
assert!(status.success());
@@ -74,6 +80,8 @@ pub fn setup(command: &str) -> Setup {
7480
.arg("oci-image:latest")
7581
.arg("fs")
7682
.current_dir(actor_dir.path())
83+
.stdout(std::process::Stdio::null())
84+
.stderr(std::process::Stdio::null())
7785
.status()
7886
.unwrap();
7987
assert!(status.success());

0 commit comments

Comments
 (0)