Browse code

Revert the fix to invalid handles due to a platform bug

Signed-off-by: Darren Stahl <darst@microsoft.com>

Darren Stahl authored on 2016/09/21 09:31:24
Showing 3 changed files
... ...
@@ -224,11 +224,6 @@ func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendly
224 224
 	}
225 225
 
226 226
 	pid := newProcess.Pid()
227
-	openedProcess, err := container.hcsContainer.OpenProcess(pid)
228
-	if err != nil {
229
-		logrus.Errorf("AddProcess %s OpenProcess() failed %s", containerID, err)
230
-		return err
231
-	}
232 227
 
233 228
 	stdin, stdout, stderr, err = newProcess.Stdio()
234 229
 	if err != nil {
... ...
@@ -255,7 +250,7 @@ func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendly
255 255
 			systemPid:    uint32(pid),
256 256
 		},
257 257
 		commandLine: createProcessParms.CommandLine,
258
-		hcsProcess:  openedProcess,
258
+		hcsProcess:  newProcess,
259 259
 	}
260 260
 
261 261
 	// Add the process to the container's list of processes
... ...
@@ -93,20 +93,10 @@ func (ctr *container) start() error {
93 93
 	ctr.startedAt = time.Now()
94 94
 
95 95
 	pid := newProcess.Pid()
96
-	openedProcess, err := ctr.hcsContainer.OpenProcess(pid)
97
-	if err != nil {
98
-		logrus.Errorf("OpenProcess() failed %s", err)
99
-		if err := ctr.terminate(); err != nil {
100
-			logrus.Errorf("Failed to cleanup after a failed OpenProcess. %s", err)
101
-		} else {
102
-			logrus.Debugln("Cleaned up after failed OpenProcess by calling Terminate")
103
-		}
104
-		return err
105
-	}
106 96
 
107 97
 	// Save the hcs Process and PID
108 98
 	ctr.process.friendlyName = InitFriendlyName
109
-	ctr.process.hcsProcess = openedProcess
99
+	ctr.process.hcsProcess = newProcess
110 100
 
111 101
 	// If this is a servicing container, wait on the process synchronously here and
112 102
 	// if it succeeds, wait for it cleanly shutdown and merge into the parent container.
... ...
@@ -47,6 +47,6 @@ func createStdInCloser(pipe io.WriteCloser, process hcsshim.Process) io.WriteClo
47 47
 			}
48 48
 		}
49 49
 
50
-		return process.Close()
50
+		return err
51 51
 	})
52 52
 }