Преглед на файлове

Merge pull request #32274 from mlaventure/fix-healthcheck-rm-race

Ensure health probe is stopped when a container exits
Vincent Demeester преди 8 години
родител
ревизия
d7e7aa67ea
променени са 1 файла, в които са добавени 4 реда и са изтрити 2 реда
  1. 4 2
      daemon/monitor.go

+ 4 - 2
daemon/monitor.go

@@ -45,7 +45,7 @@ func (daemon *Daemon) StateChanged(id string, e libcontainerd.StateInfo) error {
 		c.StreamConfig.Wait()
 		c.StreamConfig.Wait()
 		c.Reset(false)
 		c.Reset(false)
 
 
-		restart, wait, err := c.RestartManager().ShouldRestart(e.ExitCode, false, time.Since(c.StartedAt))
+		restart, wait, err := c.RestartManager().ShouldRestart(e.ExitCode, c.HasBeenManuallyStopped, time.Since(c.StartedAt))
 		if err == nil && restart {
 		if err == nil && restart {
 			c.RestartCount++
 			c.RestartCount++
 			c.SetRestarting(platformConstructExitStatus(e))
 			c.SetRestarting(platformConstructExitStatus(e))
@@ -54,7 +54,9 @@ func (daemon *Daemon) StateChanged(id string, e libcontainerd.StateInfo) error {
 			defer autoRemove()
 			defer autoRemove()
 		}
 		}
 
 
-		daemon.updateHealthMonitor(c)
+		// cancel healthcheck here, they will be automatically
+		// restarted if/when the container is started again
+		daemon.stopHealthchecks(c)
 		attributes := map[string]string{
 		attributes := map[string]string{
 			"exitCode": strconv.Itoa(int(e.ExitCode)),
 			"exitCode": strconv.Itoa(int(e.ExitCode)),
 		}
 		}