|
@@ -789,6 +789,19 @@ func (container *Container) monitor(callback execdriver.StartCallback) error {
|
|
|
utils.Errorf("Error running container: %s", err)
|
|
|
}
|
|
|
|
|
|
+ container.State.SetStopped(exitCode)
|
|
|
+
|
|
|
+ // FIXME: there is a race condition here which causes this to fail during the unit tests.
|
|
|
+ // If another goroutine was waiting for Wait() to return before removing the container's root
|
|
|
+ // from the filesystem... At this point it may already have done so.
|
|
|
+ // This is because State.setStopped() has already been called, and has caused Wait()
|
|
|
+ // to return.
|
|
|
+ // FIXME: why are we serializing running state to disk in the first place?
|
|
|
+ //log.Printf("%s: Failed to dump configuration to the disk: %s", container.ID, err)
|
|
|
+ if err := container.ToDisk(); err != nil {
|
|
|
+ utils.Errorf("Error dumping container state to disk: %s\n", err)
|
|
|
+ }
|
|
|
+
|
|
|
// Cleanup
|
|
|
container.cleanup()
|
|
|
|
|
@@ -797,23 +810,12 @@ func (container *Container) monitor(callback execdriver.StartCallback) error {
|
|
|
container.stdin, container.stdinPipe = io.Pipe()
|
|
|
}
|
|
|
|
|
|
- container.State.SetStopped(exitCode)
|
|
|
-
|
|
|
if container.runtime != nil && container.runtime.srv != nil {
|
|
|
container.runtime.srv.LogEvent("die", container.ID, container.runtime.repositories.ImageName(container.Image))
|
|
|
}
|
|
|
|
|
|
close(container.waitLock)
|
|
|
|
|
|
- // FIXME: there is a race condition here which causes this to fail during the unit tests.
|
|
|
- // If another goroutine was waiting for Wait() to return before removing the container's root
|
|
|
- // from the filesystem... At this point it may already have done so.
|
|
|
- // This is because State.setStopped() has already been called, and has caused Wait()
|
|
|
- // to return.
|
|
|
- // FIXME: why are we serializing running state to disk in the first place?
|
|
|
- //log.Printf("%s: Failed to dump configuration to the disk: %s", container.ID, err)
|
|
|
- container.ToDisk()
|
|
|
-
|
|
|
return err
|
|
|
}
|
|
|
|