Integrated: 8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259
Daniel Jeliński
djelinski at openjdk.org
Tue Jun 11 17:37:20 UTC 2024
On Thu, 6 Jun 2024 18:40:51 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.
This pull request has now been integrated.
Changeset: b77bd5fd
Author: Daniel Jeliński <djelinski at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/b77bd5fd6a6f7ddbed90300fba790da4fb683275
Stats: 50 lines in 4 files changed: 19 ins; 16 del; 15 mod
8333742: ProcessImpl and ProcessHandleImpl may mishandle processes that exit with code 259
Reviewed-by: rriggs
-------------
PR: https://git.openjdk.org/jdk/pull/19586
More information about the core-libs-dev
mailing list