Bug 1340735 - Terminate process when failing to attach it to job group. r=mhowell
authorKris Maglione <maglione.k@gmail.com>
Fri, 17 Feb 2017 15:30:24 -0800
changeset 343673 acf9b36c79170b23803d354a7fae1f89033b3e04
parent 343672 3e179eea4ffca0aad0f79c19fb9f0e02a82560a9
child 343674 8cc7d383df21ee79c29dc8ab0942f676569cd1c4
push id87183
push usermaglione.k@gmail.com
push dateSun, 19 Feb 2017 18:29:02 +0000
treeherdermozilla-inbound@acf9b36c7917 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhowell
bugs1340735
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1340735 - Terminate process when failing to attach it to job group. r=mhowell MozReview-Commit-ID: BVCPRFH6TV2
toolkit/modules/subprocess/subprocess_worker_win.js
--- a/toolkit/modules/subprocess/subprocess_worker_win.js
+++ b/toolkit/modules/subprocess/subprocess_worker_win.js
@@ -516,17 +516,20 @@ class Process extends BaseProcess {
       ok = libc.SetInformationJobObject(this.jobHandle, win32.JobObjectExtendedLimitInformation,
                                         ctypes.cast(info.address(), ctypes.voidptr_t),
                                         info.constructor.size);
       errorMessage = `Failed to set job limits: 0x${(ctypes.winLastError || 0).toString(16)}`;
     }
 
     if (ok) {
       ok = libc.AssignProcessToJobObject(this.jobHandle, procInfo.hProcess);
-      errorMessage = `Failed to attach process to job object: 0x${(ctypes.winLastError || 0).toString(16)}`;
+      if (!ok) {
+        errorMessage = `Failed to attach process to job object: 0x${(ctypes.winLastError || 0).toString(16)}`;
+        libc.TerminateProcess(procInfo.hProcess, TERMINATE_EXIT_CODE);
+      }
     }
 
     if (!ok) {
       for (let pipe of this.pipes) {
         pipe.close();
       }
       throw new Error(errorMessage);
     }