mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix race condition in sending started signal from monitor
Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
This commit is contained in:
parent
17112704b9
commit
1480168e9f
1 changed files with 5 additions and 3 deletions
|
@ -244,10 +244,12 @@ func (m *containerMonitor) callback(command *execdriver.Command) {
|
||||||
|
|
||||||
m.container.State.SetRunning(command.Pid())
|
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)
|
close(m.startSignal)
|
||||||
m.startSignal = nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := m.container.ToDisk(); err != nil {
|
if err := m.container.ToDisk(); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue