On Wed, 8 Jul 2026 08:12:23 GMT, Serguei Spitsyn <[email protected]> wrote:
>> Coleen Phillimore has updated the pull request incrementally with two
>> additional commits since the last revision:
>>
>> - Fix PlatformSupportImpl due to some internal code review comments.
>> - Add similar jps wording.
>
> src/jdk.internal.jvmstat/linux/classes/sun/jvmstat/PlatformSupportImpl.java
> line 207:
>
>> 205: seenProc = true;
>> 206: continue;
>> 207: }
>
> Q1: How would the above work if the TMP directory was set/customized with the
> option:
> `-XX:AltTempDir=/work/proc/tmp` ? What happens if there are multiple `proc`
> path folders?
I thought I had suggested a fairly naive getLocalVmId(File) in
PlatformSupportImpl.java, but it does handle extra "proc" elements.
It needs to parse directories like:
/proc/{pid}/root/tmp/hsperfdata_{user}/{nspid}
-XX:AltTempDir=/tmp/proc/scratch does not fool it, as it will be parsing
/proc/PID/tmp/proc/scratch/...
..and only looks at PID after the first "proc". Subsequent "proc" elements
mean nothing.
What does fool it, is AltTempDir=/tmp/x/hsperfdata_kwalls/foo
..where it assumes hsperfdata_ in a path element is followed by a pid/nspid.
We can handle the Integer parsing, and continue to the next path element.
But that means it's a problem if using
AltTempDir=/tmp/x/hsperfdata_kwalls/foo/123
So, remove the "break" and always count the last pid/nspid we see.
@coleenp This update works with these crazier AltTempDir settings:
"src/jdk.internal.jvmstat/linux/classes/sun/jvmstat/PlatformSupportImpl.java"
line 217
if (seenPerf) {
// Parse pid or nspid after seeing "hsperfdata_"
try {
if (hostpid == -1) {
hostpid = Integer.parseInt(s);
} else {
nspid = Integer.parseInt(s);
}
} catch (NumberFormatException _) {
// e.g. Extra "hsperfdata_" found in path from AltTempDir.
}
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/31407#discussion_r3543528042