Bug 1340735 - Terminate process when failing to attach it to job group. r=mhowell, a=jcristau
authorKris Maglione <maglione.k@gmail.com>
Fri, 17 Feb 2017 15:30:24 -0800
changeset 359349 025f8110974059ac7884d8b4316c9168afcc8d96
parent 359348 d4e8a7b1832dc6cfe52b8a9dcf0133b2733418cb
child 359350 3cd7637cb8733d8b08e15b387c8bafcd6e2a4999
push id10775
push userryanvm@gmail.com
push dateTue, 21 Feb 2017 16:31:08 +0000
treeherdermozilla-aurora@63baf28e129e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhowell, jcristau
bugs1340735
milestone53.0a2
Bug 1340735 - Terminate process when failing to attach it to job group. r=mhowell, a=jcristau 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);
     }