mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
daemon: stop health checks before deleting task
Prevent new health check probes from racing the task deletion. This may have been a root cause of containers taking so long to stop on Windows. Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
parent
d0731af939
commit
8b748bd326
1 changed files with 5 additions and 3 deletions
|
@ -28,6 +28,11 @@ func (daemon *Daemon) setStateCounter(c *container.Container) {
|
|||
func (daemon *Daemon) handleContainerExit(c *container.Container, e *libcontainerdtypes.EventInfo) error {
|
||||
var exitStatus container.ExitStatus
|
||||
c.Lock()
|
||||
|
||||
// Health checks will be automatically restarted if/when the
|
||||
// container is started again.
|
||||
daemon.stopHealthchecks(c)
|
||||
|
||||
tsk, ok := c.Task()
|
||||
if ok {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
|
@ -72,9 +77,6 @@ func (daemon *Daemon) handleContainerExit(c *container.Container, e *libcontaine
|
|||
restart = false
|
||||
}
|
||||
|
||||
// cancel healthcheck here, they will be automatically
|
||||
// restarted if/when the container is started again
|
||||
daemon.stopHealthchecks(c)
|
||||
attributes := map[string]string{
|
||||
"exitCode": strconv.Itoa(exitStatus.ExitCode),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue