Fixing race in Windows container servicing

There exists a race in container servicing on Windows where, during normal operation, the container will begin to shut itself down while docker calls shutdown explicitly.  If the former succeeds just as the latter is attempting to communicate with the container to request the shutdown, an error comes back that can cause the servicing to incorrectly register as a failure.  Instead, we just wait for the servicing container to shutdown on it's own, using a reasonable timeout to allow for merging in the updates.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
Upstream-commit: 6591a37aaffa36b857db4b8c91b8f55942ab5730
Component: engine
This commit is contained in:
Stefan J. Wernli
2016-08-15 14:32:50 -07:00
parent 07a4c41b9a
commit 5fafd959b5
@@ -95,7 +95,7 @@ func (ctr *container) start() error {
ctr.process.hcsProcess = hcsProcess
// If this is a servicing container, wait on the process synchronously here and
// immediately call shutdown/terminate when it returns.
// if it succeeds, wait for it cleanly shutdown and merge into the parent container.
if isServicing {
exitCode := ctr.waitProcessExitCode(&ctr.process)
@@ -104,7 +104,7 @@ func (ctr *container) start() error {
return ctr.terminate()
}
return ctr.shutdown()
return ctr.hcsContainer.WaitTimeout(time.Minute * 5)
}
var stdout, stderr io.ReadCloser