From cebbebbe8a0ec886d70e81db19caa996a7c2e8fd Mon Sep 17 00:00:00 2001 From: Quanwei Zhou Date: Mon, 18 Jul 2022 21:44:18 +0800 Subject: [PATCH] runtime-rs: fix ctr exit failed During use, there will be cases where the container is in the stop state and get another stop. In this case, the second stop needs to be ignored. Fixes: #4683 Signed-off-by: Quanwei Zhou --- .../virt_container/src/container_manager/container_inner.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/runtime-rs/crates/runtimes/virt_container/src/container_manager/container_inner.rs b/src/runtime-rs/crates/runtimes/virt_container/src/container_manager/container_inner.rs index f9ff08ebfa..6cfaef7ff3 100644 --- a/src/runtime-rs/crates/runtimes/virt_container/src/container_manager/container_inner.rs +++ b/src/runtime-rs/crates/runtimes/virt_container/src/container_manager/container_inner.rs @@ -193,7 +193,13 @@ impl ContainerInner { ) -> Result<()> { let logger = logger_with_process(process); info!(logger, "begin to stop process"); + // do not stop again when state stopped, may cause multi cleanup resource + let state = self.init_process.get_status().await; + if state == ProcessStatus::Stopped { + return Ok(()); + } + self.check_state(vec![ProcessStatus::Running]) .await .context("check state")?;