From 9bbb1916873af1e10d42bd33ab0edacd5fc58a22 Mon Sep 17 00:00:00 2001 From: Nicolas Viennot Date: Fri, 26 Mar 2021 04:42:24 +0000 Subject: [PATCH] Remove container cleanup after checkpoint It wasn't supposed to do that --- src/cli/run.rs | 6 +++--- src/container.rs | 15 +++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/cli/run.rs b/src/cli/run.rs index f3b0a85..a192a70 100644 --- a/src/cli/run.rs +++ b/src/cli/run.rs @@ -611,10 +611,10 @@ impl super::CLI for Run { info!("Application exited with exit_code=0"); } - // The existance of the app config tells indicates if the app is - // currently running. This is used in is_app_running(). + // The existance of the app config indicates if the app may b + // running (see is_app_running()), so it's better to take it out. if let Err(e) = AppConfig::remove() { - error!("{}", e); + error!("{}, but it's okay", e); } app_exit_result diff --git a/src/container.rs b/src/container.rs index 7e1dc0c..f2e2cc6 100644 --- a/src/container.rs +++ b/src/container.rs @@ -397,12 +397,8 @@ fn prepare_pty_namespace_and_reopen_fds() -> Result<()> { // PID namespace ////////////////////////////////// -fn monitor_container(container_pid: Pid) -> ! { - let result = monitor_child(container_pid); - - cleanup_current_container(); - - if let Err(e) = result { +fn container_monitor_exit_process(monitor_child_result: Result<()>) -> ! { + if let Err(e) = monitor_child_result { // Our child logs errors when exiting, so we skip logging in this case match e.downcast_ref::() { Some(ChildDied::Exited(_)) => {}, @@ -432,7 +428,9 @@ fn prepare_pid_namespace() -> Result<()> { write_container_pid_file(container_pid) .map_err(|e| { let _ = kill(container_pid, signal::SIGKILL); e })?; - monitor_container(container_pid); + let result = monitor_child(container_pid); + cleanup_current_container(); + container_monitor_exit_process(result); // unreachable } @@ -555,7 +553,8 @@ fn nsenter(name: &str) -> Result<()> { raise_all_effective_caps_to_ambient()?; if let ForkResult::Parent { child: pid } = fork()? { - monitor_container(pid); + let result = monitor_child(pid); + container_monitor_exit_process(result); // unreachable }