Skip to content

Commit

Permalink
linux: skip errors from the runtime kill
Browse files Browse the repository at this point in the history
fix a race condition where the container process could exit before the
runtime sends the signal, causing the command to fail.

Part of: containers/crun#422

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Jul 2, 2020
1 parent 2f04b7d commit 38edd8e
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions run_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,13 +841,8 @@ func runUsingRuntime(isolation Isolation, options RunOptions, configureNetwork b
stopped := false
defer func() {
if !stopped {
err2 := kill.Run()
if err2 != nil {
if err == nil {
err = errors.Wrapf(err2, "error stopping container")
} else {
logrus.Infof("error stopping container: %v", err2)
}
if err2 := kill.Run(); err2 != nil {
logrus.Infof("error stopping container: %v", err2)
}
}
}()
Expand Down

0 comments on commit 38edd8e

Please sign in to comment.