Fix race condition in sending started signal from monitor

Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
Upstream-commit: 1480168e9f6178e4015aa4dcc035a6963c59f431
Component: engine
This commit is contained in:
Alexandr Morozov
2014-08-14 11:01:39 +04:00
parent c395d23539
commit f4db7d15dc

View File

@ -244,10 +244,12 @@ func (m *containerMonitor) callback(command *execdriver.Command) {
m.container.State.SetRunning(command.Pid())
if m.startSignal != nil {
// signal that the process has started
// signal that the process has started
// close channel only if not closed
select {
case <-m.startSignal:
default:
close(m.startSignal)
m.startSignal = nil
}
if err := m.container.ToDisk(); err != nil {