Revert the fix to invalid handles due to a platform bug

Signed-off-by: Darren Stahl <darst@microsoft.com>
This commit is contained in:
Darren Stahl 2016-09-20 17:31:24 -07:00
parent 2a3205d7b7
commit f6d5f7b975
3 changed files with 3 additions and 18 deletions

View file

@ -224,11 +224,6 @@ func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendly
} }
pid := newProcess.Pid() pid := newProcess.Pid()
openedProcess, err := container.hcsContainer.OpenProcess(pid)
if err != nil {
logrus.Errorf("AddProcess %s OpenProcess() failed %s", containerID, err)
return err
}
stdin, stdout, stderr, err = newProcess.Stdio() stdin, stdout, stderr, err = newProcess.Stdio()
if err != nil { if err != nil {
@ -255,7 +250,7 @@ func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendly
systemPid: uint32(pid), systemPid: uint32(pid),
}, },
commandLine: createProcessParms.CommandLine, commandLine: createProcessParms.CommandLine,
hcsProcess: openedProcess, hcsProcess: newProcess,
} }
// Add the process to the container's list of processes // Add the process to the container's list of processes

View file

@ -93,20 +93,10 @@ func (ctr *container) start() error {
ctr.startedAt = time.Now() ctr.startedAt = time.Now()
pid := newProcess.Pid() pid := newProcess.Pid()
openedProcess, err := ctr.hcsContainer.OpenProcess(pid)
if err != nil {
logrus.Errorf("OpenProcess() failed %s", err)
if err := ctr.terminate(); err != nil {
logrus.Errorf("Failed to cleanup after a failed OpenProcess. %s", err)
} else {
logrus.Debugln("Cleaned up after failed OpenProcess by calling Terminate")
}
return err
}
// Save the hcs Process and PID // Save the hcs Process and PID
ctr.process.friendlyName = InitFriendlyName ctr.process.friendlyName = InitFriendlyName
ctr.process.hcsProcess = openedProcess ctr.process.hcsProcess = newProcess
// If this is a servicing container, wait on the process synchronously here and // If this is a servicing container, wait on the process synchronously here and
// if it succeeds, wait for it cleanly shutdown and merge into the parent container. // if it succeeds, wait for it cleanly shutdown and merge into the parent container.

View file

@ -47,6 +47,6 @@ func createStdInCloser(pipe io.WriteCloser, process hcsshim.Process) io.WriteClo
} }
} }
return process.Close() return err
}) })
} }