RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 [v2]
Roger Riggs
rriggs at openjdk.org
Mon Jun 10 19:48:13 UTC 2024
On Mon, 10 Jun 2024 16:28:39 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:
>> `GetExitCodeProcess` method is not reliable for checking if a process exited already; it returns 259 (STILL_ACTIVE) if the process hasn't exited yet, but the same value is returned when the process exited with code 259. In order to check if the process exited, we need to check if its handle is in a signaled state using one of the wait methods.
>>
>> This PR fixes the onExit, exitValue, isAlive, and waitFor(timeout) methods to correctly handle the problematic exit code.
>>
>> I haven't fixed the ProcessImpl.toString method. I'm not sure the problem is important enough to justify an extra JNI call in the (probably typical) still-alive case.
>>
>> Tier1-3 testing clean. I modified the existing OnExitTest to cover this case.
>
> Daniel Jeliński has updated the pull request incrementally with one additional commit since the last revision:
>
> waitForProcessExit0 should ignore interrupts
LGTM
-------------
Marked as reviewed by rriggs (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/19586#pullrequestreview-2108626204
More information about the core-libs-dev
mailing list