RFR: JDK-8315026: java/lang/ProcessHandle/TreeTest.java fails intermittent on AIX in TreeTest.test5 [v4]

Matthias Baesken mbaesken at openjdk.org
Wed Oct 11 12:23:10 UTC 2023


On Wed, 11 Oct 2023 12:06:54 GMT, Joachim Kern <jkern at openjdk.org> wrote:

>> 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)".
>
> Hi Thomas, this function is just the same as the linux and macos implementation. And I do not want to make more changes as really needed, otherwise the siblings character gets lost. Following your proposal means to do the split for linux and macos too. And to be honest, I do not really know the intention of the function, maybe the implementation is wrong on all platforms. So my goal was to only exchange the used API and keep everything else as on linux. This is my defensive approach.

Probably keep the function without split into 2 functions, but just adjust the comment a bit  as Thomas suggested ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16051#discussion_r1354878044


More information about the core-libs-dev mailing list