On Mon, 29 Jun 2026 21:41:37 GMT, David Holmes <[email protected]> wrote:
> For an attempt at clarity let me summarise my concern/confusion...
Right, hsperfdata and attach/socket file happen to both be under /tmp (or its
alternative) and we probably don't want to make them independent of that now.
But they do have different length requirements.
(This length for the socket file was never a problem when it was hard-coded to
/tmp I suppose.)
If you specify a long AltTempDir then hsperfdata could still work (jps/jcmd
process listing is fine, jstat is fine) but an attach can fail to create the
socket. i.e. If you run with a long AltTempDir, you could find you can't
attach.
Should we let the shorter socket limit override the perfdata file length, and
fail on startup as it currently does... Or should we still run, but let attach
attempts fail?
I quite like the idea of permitting a too-long-for-socket AltTempDir, but
failing later on any attach attempts, as it should be quite obvious what the
problem is.
When attached to, we show this about 6 times before giving up:
[39.048s][warning][attach] Failed to create temporary file for attach
/work/aaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbccccccccccccccccccddddddddddddddddddeeeeeeeeeeeeeeeeee/.java_pid209:
file name is too long
and 10s or so later the attaching tool says:
com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file
/proc/330033/root/work/aaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbccccccccccccccccccddddddddddddddddddeeeeeeeeeeeeeeeeee/.java_pid209:
target process 330033 doesn't respond within 10500ms or HotSpot VM not loaded
at
jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:122)
at
jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:56)
at
jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:201)
at jdk.jcmd/sun.tools.jcmd.JCmd.executeCommandForPid(JCmd.java:113)
at jdk.jcmd/sun.tools.jcmd.JCmd.main(JCmd.java:97)
...the attacher side there could be more specific about the socket path being
too long.
Ideally it could realise straight away and not take 10 seconds to fail.
--
If AltTempDir is near to the socket path length max, we could warn on startup
but still use it. And ignore it only if longer than PATH_MAX.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/31407#issuecomment-4843741078