From 717209c9ffc5caa4782dfda39e7be9a7b581a42c Mon Sep 17 00:00:00 2001 From: Darren Stahl Date: Wed, 25 May 2016 21:33:50 -0700 Subject: [PATCH] Fix a leaked process handle of the first container to start on Windows Signed-off-by: Darren Stahl --- libcontainerd/container_windows.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libcontainerd/container_windows.go b/libcontainerd/container_windows.go index 8aac716b72..467c8ff294 100644 --- a/libcontainerd/container_windows.go +++ b/libcontainerd/container_windows.go @@ -167,6 +167,10 @@ func (ctr *container) waitExit(process *process, isFirstProcessToStart bool) err // has exited to avoid a container being dropped on the floor. } + if err := process.hcsProcess.Close(); err != nil { + logrus.Error(err) + } + // Assume the container has exited si := StateInfo{ CommonStateInfo: CommonStateInfo{ @@ -180,9 +184,6 @@ func (ctr *container) waitExit(process *process, isFirstProcessToStart bool) err // But it could have been an exec'd process which exited if !isFirstProcessToStart { - if err := process.hcsProcess.Close(); err != nil { - logrus.Error(err) - } si.State = StateExitProcess } else { updatePending, err := ctr.hcsContainer.HasPendingUpdates()