Signed-off-by: Lei Jitang <leijitang@huawei.com>
Lei Jitang authored on 2016/01/27 17:06:45... | ... |
@@ -38,9 +38,10 @@ func (daemon *Daemon) containerStop(container *container.Container, seconds int) |
38 | 38 |
return nil |
39 | 39 |
} |
40 | 40 |
|
41 |
- // 1. Send a SIGTERM |
|
42 |
- if err := daemon.killPossiblyDeadProcess(container, container.StopSignal()); err != nil { |
|
43 |
- logrus.Infof("Failed to send SIGTERM to the process, force killing") |
|
41 |
+ stopSignal := container.StopSignal() |
|
42 |
+ // 1. Send a stop signal |
|
43 |
+ if err := daemon.killPossiblyDeadProcess(container, stopSignal); err != nil { |
|
44 |
+ logrus.Infof("Failed to send signal %d to the process, force killing", stopSignal) |
|
44 | 45 |
if err := daemon.killPossiblyDeadProcess(container, 9); err != nil { |
45 | 46 |
return err |
46 | 47 |
} |
... | ... |
@@ -48,7 +49,7 @@ func (daemon *Daemon) containerStop(container *container.Container, seconds int) |
48 | 48 |
|
49 | 49 |
// 2. Wait for the process to exit on its own |
50 | 50 |
if _, err := container.WaitStop(time.Duration(seconds) * time.Second); err != nil { |
51 |
- logrus.Infof("Container %v failed to exit within %d seconds of SIGTERM - using the force", container.ID, seconds) |
|
51 |
+ logrus.Infof("Container %v failed to exit within %d seconds of signal %d - using the force", container.ID, seconds, stopSignal) |
|
52 | 52 |
// 3. If it doesn't, then send SIGKILL |
53 | 53 |
if err := daemon.Kill(container); err != nil { |
54 | 54 |
container.WaitStop(-1 * time.Second) |