Skip to content

Commit

Permalink
Correct the info message when stop container
Browse files Browse the repository at this point in the history
Signed-off-by: Lei Jitang <[email protected]>
  • Loading branch information
coolljt0725 committed Jan 27, 2016
1 parent 63f8429 commit 6716a3a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions daemon/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@ func (daemon *Daemon) containerStop(container *container.Container, seconds int)
return nil
}

// 1. Send a SIGTERM
if err := daemon.killPossiblyDeadProcess(container, container.StopSignal()); err != nil {
logrus.Infof("Failed to send SIGTERM to the process, force killing")
stopSignal := container.StopSignal()
// 1. Send a stop signal
if err := daemon.killPossiblyDeadProcess(container, stopSignal); err != nil {
logrus.Infof("Failed to send signal %d to the process, force killing", stopSignal)
if err := daemon.killPossiblyDeadProcess(container, 9); err != nil {
return err
}
}

// 2. Wait for the process to exit on its own
if _, err := container.WaitStop(time.Duration(seconds) * time.Second); err != nil {
logrus.Infof("Container %v failed to exit within %d seconds of SIGTERM - using the force", container.ID, seconds)
logrus.Infof("Container %v failed to exit within %d seconds of signal %d - using the force", container.ID, seconds, stopSignal)
// 3. If it doesn't, then send SIGKILL
if err := daemon.Kill(container); err != nil {
container.WaitStop(-1 * time.Second)
Expand Down

0 comments on commit 6716a3a

Please sign in to comment.