RFR: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259 [v2]
Daniel Jeliński
djelinski at openjdk.org
Mon Jun 10 16:28:39 UTC 2024
> `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
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/19586/files
- new: https://git.openjdk.org/jdk/pull/19586/files/e2b457bf..4ff37ced
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=19586&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=19586&range=00-01
Stats: 11 lines in 1 file changed: 0 ins; 8 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/19586.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/19586/head:pull/19586
PR: https://git.openjdk.org/jdk/pull/19586
More information about the core-libs-dev
mailing list