Skip to content

Commit

Permalink
task: fix leaking files of exec process
Browse files Browse the repository at this point in the history
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
  • Loading branch information
Burning1020 committed Jan 24, 2024
1 parent 0b8d74e commit 256a492
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vmm/task/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use oci_spec::runtime::{LinuxResources, Process, Spec};
use runc::{options::GlobalOpts, Runc, Spawner};
use serde::Deserialize;
use tokio::{
fs::File,
fs::{remove_file, File},
io::{AsyncBufReadExt, AsyncRead, AsyncReadExt, AsyncSeekExt, BufReader},
process::Command,
sync::Mutex,
Expand Down Expand Up @@ -519,8 +519,10 @@ impl ProcessLifecycle<ExecProcess> for KuasarExecLifecycle {
}
}

async fn delete(&self, _p: &mut ExecProcess) -> containerd_shim::Result<()> {
async fn delete(&self, p: &mut ExecProcess) -> Result<()> {
self.exit_signal.signal();
let exec_pid_path = Path::new(self.bundle.as_str()).join(format!("{}.pid", p.id));
remove_file(exec_pid_path).await.unwrap_or_default();
Ok(())
}

Expand Down

0 comments on commit 256a492

Please sign in to comment.