Browse Source

Fix race between execdriver.Kill and execdriver.Run

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Alexander Morozov 10 năm trước cách đây
mục cha
commit
ca7219f5da

+ 2 - 0
daemon/execdriver/native/driver.go

@@ -245,7 +245,9 @@ func waitInPIDHost(p *libcontainer.Process, c libcontainer.Container) func() (*o
 }
 }
 
 
 func (d *driver) Kill(c *execdriver.Command, sig int) error {
 func (d *driver) Kill(c *execdriver.Command, sig int) error {
+	d.Lock()
 	active := d.activeContainers[c.ID]
 	active := d.activeContainers[c.ID]
+	d.Unlock()
 	if active == nil {
 	if active == nil {
 		return fmt.Errorf("active container for %s does not exist", c.ID)
 		return fmt.Errorf("active container for %s does not exist", c.ID)
 	}
 	}