Skip to content

Commit

Permalink
Remove container cleanup after checkpoint
Browse files Browse the repository at this point in the history
It wasn't supposed to do that
  • Loading branch information
nviennot committed Mar 26, 2021
1 parent 6af91ae commit 9bbb191
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 7 additions & 8 deletions src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<ChildDied>() {
Some(ChildDied::Exited(_)) => {},
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 9bbb191

Please sign in to comment.