On Fri, 19 Aug 2022 17:05:38 GMT, Roger Riggs <rri...@openjdk.org> wrote:

> On Mac OS X on aarch64, the timing of the sysctl vs the process life (pid) 
> can be such that the sysctl returns EIO.
> The native implementation is modified to treat EIO the same as EINVAL, 
> leaving the information to be returned empty.
> 
> Several tests in java/lang/ProcessHandle failed with the same cause including 
> OnExitTest, InfoTest, and TreeTest.

Hello Roger,

> On Mac OS X on aarch64, the timing of the sysctl vs the process life (pid) 
> can be such that the sysctl returns EIO.

The `ProcessHandleImpl_unix.c` in its `info0` implementation calls 
`os_getParentPidAndTimings` and this `os_getCmdlineAndUserInfo`. The  
`os_getParentPidAndTimings` in `ProcessHandleImpl_macosx.c` too has a call to 
`systctl` with the passed `pid` (line 191). If that call fails, we currently 
don't check the `errno` and just throw a `RuntimeException`. Would that need a 
change too, since it queries for a particular process?

There's one another call to sysctl in `os_getCmdlineAndUserInfo` at line 253, 
but that doesn't appear to be specific to the pid, so I guess that wouldn't 
fail due to the timing of process lifetime.

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

PR: https://git.openjdk.org/jdk/pull/9946

Reply via email to