mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix some issues with locking on the container
- Fix OOM event updating healthchecks and persisting container state without locks - Fix healthchecks being updated without locks on container stop Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
parent
e4d0fe84f9
commit
972cb49787
3 changed files with 6 additions and 2 deletions
|
@ -64,6 +64,8 @@ func (daemon *Daemon) killWithSignal(container *containerpkg.Container, sig int)
|
|||
container.Lock()
|
||||
defer container.Unlock()
|
||||
|
||||
daemon.stopHealthchecks(container)
|
||||
|
||||
if !container.Running {
|
||||
return errNotRunning(container.ID)
|
||||
}
|
||||
|
|
|
@ -39,10 +39,14 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerd.EventType, ei libc
|
|||
if runtime.GOOS == "windows" {
|
||||
return errors.New("received StateOOM from libcontainerd on Windows. This should never happen")
|
||||
}
|
||||
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
daemon.updateHealthMonitor(c)
|
||||
if err := c.CheckpointTo(daemon.containersReplica); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
daemon.LogContainerEvent(c, "oom")
|
||||
case libcontainerd.EventExit:
|
||||
if int(ei.Pid) == c.Pid {
|
||||
|
|
|
@ -43,8 +43,6 @@ func (daemon *Daemon) containerStop(container *containerpkg.Container, seconds i
|
|||
return nil
|
||||
}
|
||||
|
||||
daemon.stopHealthchecks(container)
|
||||
|
||||
stopSignal := container.StopSignal()
|
||||
// 1. Send a stop signal
|
||||
if err := daemon.killPossiblyDeadProcess(container, stopSignal); err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue