Przeglądaj źródła

Revert the fix to invalid handles due to a platform bug

Signed-off-by: Darren Stahl <darst@microsoft.com>
Darren Stahl 8 lat temu
rodzic
commit
f6d5f7b975

+ 1 - 6
libcontainerd/client_windows.go

@@ -224,11 +224,6 @@ func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendly
 	}
 
 	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()
 	if err != nil {
@@ -255,7 +250,7 @@ func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendly
 			systemPid:    uint32(pid),
 		},
 		commandLine: createProcessParms.CommandLine,
-		hcsProcess:  openedProcess,
+		hcsProcess:  newProcess,
 	}
 
 	// Add the process to the container's list of processes

+ 1 - 11
libcontainerd/container_windows.go

@@ -93,20 +93,10 @@ func (ctr *container) start() error {
 	ctr.startedAt = time.Now()
 
 	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
 	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 it succeeds, wait for it cleanly shutdown and merge into the parent container.

+ 1 - 1
libcontainerd/process_windows.go

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