RFR: 8376052: Use AttachOperationFailedException rather than AttachNotSupportedException in findTargetProcessTmpDirectory() [v2]
Yasumasa Suenaga
ysuenaga at openjdk.org
Thu Jan 22 13:49:50 UTC 2026
On Thu, 22 Jan 2026 12:09:28 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> Can you please provide an example where IOException is thrown?
I could not produce IOException, but it might occur if filesystem is broken.
AccessDeniedException would happen as following. We can see it easy on attach to rootless container.
# ./jcmd 1 VM.version
1:
java.nio.file.AccessDeniedException: /proc/1/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:280)
at jdk.attach/sun.tools.attach.VirtualMachineImpl.findSocketFile(VirtualMachineImpl.java:236)
at jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:87)
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)
> It would be useful to get an example or two of when MonitorException is thrown.
As I said before, I cannot find out the location to throw MonitorException in JDK source around attach mechanism, but it might happen if the user uses custom attach provider. Anyway it is checked exception, so it shouldn't ignore or raise assertion error.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29355#discussion_r2716993417
More information about the serviceability-dev
mailing list