On Wed, 11 Oct 2023 10:57:24 GMT, Joachim Kern <jk...@openjdk.org> wrote:
>> We see rather often failures in java/lang/ProcessHandle/TreeTest.java on AIX >> in TreeTest.test5. >> The reason is: Previously the implementation based on the /proc file system >> lead to double pids in the child list; at least intermittent. Using the API >> getprocs64() instead I was able to eliminate those double pids (and increase >> the performance by a factor of 4). Otherwise we would have to add an >> algorithm to filter out the doubles after creating the raw list. > > Joachim Kern has updated the pull request incrementally with one additional > commit since the last revision: > > cosmetic changes 2 src/java.base/aix/native/libjava/ProcessHandleImpl_aix.c line 43: > 41: /* > 42: * Returns the children of the requested pid and optionally each parent > and > 43: * start time. If requested pid is zero return all processes. This deserves at least a better explanation, because I was first wondering why you return the parent pid since that would be just, well, the pid. Then I thought "oh, maybe he traverses indirect children too, then returning the respective parent pid would make sense". And then I saw that no, you only return direct children *unless* pid is 0. So the parent pid business makes only sense for the pid==0 case. So, from looking at the implementation, the only point of the parent pid return array is if you pass in 0 as pid. This should be made clearer. Or even better, split this into two functions, one "get children(pid, returnpidarray)" and one "getAllProcesses(returnarray, ppid returnarray)". ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16051#discussion_r1354791604