On Sun, 18 Jan 2026 07:58:48 GMT, Alan Bateman <[email protected]> wrote:

> Are you 100% sure that AttachNotSupportedException make sense to throw in 
> this configuration?

Yes.
We don't know whether target process provides a compatible `AttachProvider` if 
Attach API could not access `/tmp` of target process. Target process might not 
be Java. So I think it makes sence to throw `AttachNotSupportedException` with 
the cause. The user get a hint from "Caused by" to check why Attach API failed.


[08:40:27] ~/d/e/jdk  pull/28867 ❯ 
/home/slovdahl/dev/external/jdk/build/linux-x86_64-server-release/images/jdk/bin/jcmd
 $(pgrep -f Reproducer.java) VM.version
52779:
com.sun.tools.attach.AttachNotSupportedException: Unable to access the 
filesystem of the target process
        at 
jdk.attach/sun.tools.attach.VirtualMachineImpl.findTargetProcessTmpDirectory(VirtualMachineImpl.java:292)
        at 
jdk.attach/sun.tools.attach.VirtualMachineImpl.findSocketFile(VirtualMachineImpl.java:233)
        at 
jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:84)
        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)
Caused by: java.nio.file.AccessDeniedException: /proc/52779/root/tmp
        at 
java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
        at 
java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:108)
        at 
java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:113)
        at 
java.base/sun.nio.fs.UnixFileSystemProvider.isSameFile(UnixFileSystemProvider.java:391)
        at java.base/java.nio.file.Files.isSameFile(Files.java:1418)
        at 
jdk.attach/sun.tools.attach.VirtualMachineImpl.findTargetProcessTmpDirectory(VirtualMachineImpl.java:277)
        ... 6 more

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

PR Comment: https://git.openjdk.org/jdk/pull/28867#issuecomment-3765121718

Reply via email to