On Tue, 21 Sep 2021 04:54:24 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> Roger Riggs has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   The switch from a Java child to /bin/sleep caused another test
>>   to fail on Linux.  The cleanup for a test used /usr/bin/pkill "sleep 60".
>>   A race between that cleanup and subsequent tests that used sleep 60 or 600
>>   could kill the sleep before the test of waitFor completed.
>>   Changing the test using pkill to use 59 seconds makes the test cleanup
>>   selective to the sleep spawned for that test.
>>   The test that was failing (lines 2626-2624) passes consistently.
>
> test/jdk/java/lang/ProcessBuilder/Basic.java line 2217:
> 
>> 2215:                 // A unique (59s) time is needed to avoid killing 
>> other sleep processes.
>> 2216:                 final String[] cmd = { "/bin/bash", "-c", "(/bin/sleep 
>> 59)" };
>> 2217:                 final String[] cmdkill = { "/bin/bash", "-c", 
>> "(/usr/bin/pkill -f \"sleep 59\")" };
> 
> Maybe future RFE but why do we even need pkill here when we can get the PID 
> of the sleep process we create and kill only that process?

I thought of that too, but notice the parens "()" around that /bin/sleep; that 
creates and extra level of forked processes and its harder to get that pid. 
There probably is a way to traverse the hierarchy but I'll keep it as is for 
now.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5239

Reply via email to