mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #21953 from Microsoft/jjh/containerapipostcontainerstop
Windows: Fix deamon deadlock in docker stop
This commit is contained in:
commit
d954097c0b
2 changed files with 2 additions and 6 deletions
|
@ -1231,7 +1231,7 @@ func (s *DockerSuite) TestContainerApiPostContainerStop(c *check.C) {
|
|||
c.Assert(err, checker.IsNil)
|
||||
// 204 No Content is expected, not 200
|
||||
c.Assert(statusCode, checker.Equals, http.StatusNoContent)
|
||||
c.Assert(waitInspect(containerID, "{{ .State.Running }}", "false", 5*time.Second), checker.IsNil)
|
||||
c.Assert(waitInspect(containerID, "{{ .State.Running }}", "false", 60*time.Second), checker.IsNil)
|
||||
}
|
||||
|
||||
// #14170
|
||||
|
|
|
@ -167,11 +167,6 @@ func (ctr *container) waitExit(pid uint32, processFriendlyName string, isFirstPr
|
|||
logrus.Debugf("Completed shutting down container %s", ctr.containerID)
|
||||
}
|
||||
|
||||
// BUGBUG - Is taking the lock necessary here? Should it just be taken for
|
||||
// the deleteContainer call, not for the restart logic? @jhowardmsft
|
||||
ctr.client.lock(ctr.containerID)
|
||||
defer ctr.client.unlock(ctr.containerID)
|
||||
|
||||
if si.State == StateExit && ctr.restartManager != nil {
|
||||
restart, wait, err := ctr.restartManager.ShouldRestart(uint32(exitCode), false)
|
||||
if err != nil {
|
||||
|
@ -182,6 +177,7 @@ func (ctr *container) waitExit(pid uint32, processFriendlyName string, isFirstPr
|
|||
go func() {
|
||||
err := <-wait
|
||||
ctr.restarting = false
|
||||
ctr.client.deleteContainer(ctr.friendlyName)
|
||||
if err != nil {
|
||||
si.State = StateExit
|
||||
if err := ctr.client.backend.StateChanged(ctr.containerID, si); err != nil {
|
||||
|
|
Loading…
Reference in a new issue