PID-reuse races fix, introduced GCC validation brakage

Yvan Roux <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <CAD57uCdcBjWBmifs4+KTOFLdHaRCgyxvEDH4k_UHVsFqh6wEvA@mail.gmail.com>
Hi,

https://lists.gnu.org/archive/html/dejagnu/2015-07/msg00000.html

this patch introduced  a new failure related to GDB testing, but this
time in GCC guality part of the testsuite.  When
gcc/testsuite/gcc.dg/guality/example.c is executed we have this set of
processes started

PID  PPID     command
100  99          ./example.exe
101  99          cat
102  100        sh -c gdb -nx -nw --quiet > /dev/null 2>&1 ./example.exe
103  102        gdb -nx -nw --quiet ./example.exe

The issue is that when close_wait_program is called pid="100 101" and
when the "wait" returns none of these 4 processes is actually killed,
and the killing of the "kill pipeline" made these pids untouched and
the validation hangs forever.

I not sure what's the best way to fix this issue without
re-introducing the pid race in GDB.  I'm testing a solution which
first gather all the childs processes of the close_wait_program pid
input (with a recursive call of pgrep -P) and then kill them all with
a -15, my assumption is that killing explicitly all the processes
(maybe in the child -> parent order) will avoid the need of stdin
closing and the pid re-use race, but I might be wrong, and all
comments are welcome.  It works so far on a subset of the testsuite,
but I'm still validating this approach.  Now, maybe just the reducing
the sleeping time might workaround the issue....

Cheers,
Yvan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.