On 7/25/12 1:08 PM, Chet Ramey wrote: > On 7/25/12 11:33 AM, Andreas Schwab wrote: > >> I cannot see how CHILD_MAX is related to pid reuse. CHILD_MAX is a >> per-user limit, but the pid namespace is global. If the shell forks a >> new process, and the pid of it matches one of the previously used pids >> for asynchronous jobs it can surely discard the remembered status for >> that job. > > Thanks, that's a good restatement of the problem. Your proposed solution > is one of the possibles. The question is whether or not it's necessary > (apparently on some systems) and sufficient (probably).
OK, we have some data, we have a hypothesis, and we have a way to test it. Let's test it. Michael, please apply the attached patch, disable RECYCLES_PIDS, and run your tests again. This makes the check for previously-saved exit statuses unconditional. Let's see if this is the one change of significance. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.2-patched/jobs.c 2011-01-07 10:59:29.000000000 -0500 --- jobs.c 2012-07-26 10:53:53.000000000 -0400 *************** *** 1900,1903 **** --- 1902,1908 ---- delete_old_job (pid); + #if 0 + /* Perform the check for pid reuse unconditionally. Some systems reuse + PIDs before giving a process CHILD_MAX/_SC_CHILD_MAX unique ones. */ #if !defined (RECYCLES_PIDS) /* Only check for saved status if we've saved more than CHILD_MAX *************** *** 1905,1908 **** --- 1910,1914 ---- if ((js.c_reaped + bgpids.npid) >= js.c_childmax) #endif + #endif bgp_delete (pid); /* new process, discard any saved status */