eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.24k stars 714 forks source link

(Java 22 Milestone 1) OpenJ9 does not fill process information properly on AIX #19750

Open bmarwell opened 1 month ago

bmarwell commented 1 month ago

Java 22:

Stream<ProcessHandle> ProcessHandle.allProcesses(); will return a Stream of ProcessHandle.

ProcessHandle has the ProcessHandle.Info interface.

However, all optional fields are blank on AIX ppc64:

Haven't checked the others yet.

However, since Java 22 there is a workaround: Use FFM like so:

    SymbolLookup stdLib = LINKER.defaultLookup();
    this.getargs_addr = stdLib.find("getargs").get();

    // some more init methods for getargs, e.g. signature, parameter init, etc.
    long rc = (long) getargs.invokeExact(procsInfo, procsInfo.byteSize(), argsString, argsString.byteSize());

Here is some sample code I hacked together quickly: https://github.com/bmarwell/jtop/blob/67a7a2118ceb389d1d5c9eaef26b5fd8361350a7/library/aix/src/main/java/de/bmarwell/jtop/lib/aix/AixProcess.java

Sadly, this will only return the command, not the args (despite its name). And it is cumbersome to use for "casual" java devs.

Any chance Stream<ProcessHandle> ProcessHandle.allProcesses(); could return all process information? Tested on Semeru 22 Milestone 1.

bmarwell commented 1 month ago

I found Temurin on Linux x64 to do the same, I have to look up some commands and their args in /proc/$pid/cmdline. However, all are accessible. Not sure how to do the same on AIX, getargs does not seem to return more then the command without args on AIX...

pshipton commented 1 month ago

This doesn't seem like an issue with OpenJ9 but rather with OpenJDK. The issue needs to be opened at the OpenJDK project. Semeru consumes OpenJDK mostly as-is.

bmarwell commented 1 month ago

Alright. Yeah, even Mac info seems incomplete. However, I do not have an OpenJDK account.

pshipton commented 1 month ago

Without an account you can post to the mailing list to ask about it.