浏览代码

Merge pull request #13132 from LK4D4/fix_race_kill

Fix race between execdriver.Kill and execdriver.Run
Jessie Frazelle 10 年之前
父节点
当前提交
a47fb5edca
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      daemon/execdriver/native/driver.go

+ 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 {
+	d.Lock()
 	active := d.activeContainers[c.ID]
+	d.Unlock()
 	if active == nil {
 		return fmt.Errorf("active container for %s does not exist", c.ID)
 	}