From 3694f3d9fe8d1df79de243ee1251833836ecffa4 Mon Sep 17 00:00:00 2001 From: Fupan Li Date: Mon, 6 May 2024 16:55:35 +0800 Subject: [PATCH] runtime-rs: fix the issue of the leak of dead shim We should init and asign the runtime instance to runtime handler, otherwise, if the pause container failed to start, which means the runtime instance failed to start, then the following delete & shutdown request wouldn't be run, thus the dead shim would be left. Fixes: #9597 Signed-off-by: Fupan Li --- src/runtime-rs/crates/runtimes/src/manager.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/runtime-rs/crates/runtimes/src/manager.rs b/src/runtime-rs/crates/runtimes/src/manager.rs index 766a02e115..7c7b2b78dd 100644 --- a/src/runtime-rs/crates/runtimes/src/manager.rs +++ b/src/runtime-rs/crates/runtimes/src/manager.rs @@ -128,13 +128,16 @@ impl RuntimeHandlerManagerInner { } } + let instance = Arc::new(runtime_instance); + self.runtime_instance = Some(instance.clone()); + // start sandbox - runtime_instance + instance .sandbox .start(dns, spec, state, network_env) .await .context("start sandbox")?; - self.runtime_instance = Some(Arc::new(runtime_instance)); + Ok(()) }