Skip to content

Commit c9933e5

Browse files
committed
Cygwin: spawn/exec: drop breaking away from job
Remove breaking away from job during spawn/exec because it's not required anymore for 99% of the processes. This was required back when Cygwin executables didn't have a manifest claiming compatibility with all Windows versions since Vista. These days, only very few executables missing the manifest are left, certainly none in the distro. This frees up job breakaway for potential extensions to setrlimit. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
1 parent 4b940bb commit c9933e5

1 file changed

Lines changed: 0 additions & 31 deletions

File tree

winsup/cygwin/spawn.cc

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -410,37 +410,6 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
410410
if (winjitdebug && !real_path.iscygexec ())
411411
c_flags |= CREATE_DEFAULT_ERROR_MODE;
412412

413-
/* We're adding the CREATE_BREAKAWAY_FROM_JOB flag here to workaround
414-
issues with the "Program Compatibility Assistant (PCA) Service".
415-
For some reason, when starting long running sessions from mintty(*),
416-
the affected svchost.exe process takes more and more memory and at one
417-
point takes over the CPU. At this point the machine becomes
418-
unresponsive. The only way to get back to normal is to stop the
419-
entire mintty session, or to stop the PCA service. However, a process
420-
which is controlled by PCA is part of a compatibility job, which
421-
allows child processes to break away from the job. This helps to
422-
avoid this issue.
423-
424-
First we call IsProcessInJob. It fetches the information whether or
425-
not we're part of a job 20 times faster than QueryInformationJobObject.
426-
427-
(*) Note that this is not mintty's fault. It has just been observed
428-
with mintty in the first place. See the archives for more info:
429-
http://cygwin.com/ml/cygwin-developers/2012-02/msg00018.html */
430-
JOBOBJECT_BASIC_LIMIT_INFORMATION jobinfo;
431-
BOOL is_in_job;
432-
433-
if (IsProcessInJob (GetCurrentProcess (), NULL, &is_in_job)
434-
&& is_in_job
435-
&& QueryInformationJobObject (NULL, JobObjectBasicLimitInformation,
436-
&jobinfo, sizeof jobinfo, NULL)
437-
&& (jobinfo.LimitFlags & (JOB_OBJECT_LIMIT_BREAKAWAY_OK
438-
| JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK)))
439-
{
440-
debug_printf ("Add CREATE_BREAKAWAY_FROM_JOB");
441-
c_flags |= CREATE_BREAKAWAY_FROM_JOB;
442-
}
443-
444413
if (mode == _P_DETACH)
445414
c_flags |= DETACHED_PROCESS;
446415
else

0 commit comments

Comments
 (0)