- 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>
... | ... |
@@ -39,10 +39,14 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerd.EventType, ei libc |
39 | 39 |
if runtime.GOOS == "windows" { |
40 | 40 |
return errors.New("received StateOOM from libcontainerd on Windows. This should never happen") |
41 | 41 |
} |
42 |
+ |
|
43 |
+ c.Lock() |
|
44 |
+ defer c.Unlock() |
|
42 | 45 |
daemon.updateHealthMonitor(c) |
43 | 46 |
if err := c.CheckpointTo(daemon.containersReplica); err != nil { |
44 | 47 |
return err |
45 | 48 |
} |
49 |
+ |
|
46 | 50 |
daemon.LogContainerEvent(c, "oom") |
47 | 51 |
case libcontainerd.EventExit: |
48 | 52 |
if int(ei.Pid) == c.Pid { |
... | ... |
@@ -43,8 +43,6 @@ func (daemon *Daemon) containerStop(container *containerpkg.Container, seconds i |
43 | 43 |
return nil |
44 | 44 |
} |
45 | 45 |
|
46 |
- daemon.stopHealthchecks(container) |
|
47 |
- |
|
48 | 46 |
stopSignal := container.StopSignal() |
49 | 47 |
// 1. Send a stop signal |
50 | 48 |
if err := daemon.killPossiblyDeadProcess(container, stopSignal); err != nil { |