On Thu, 22 Jan 2026 08:17:50 GMT, Yasumasa Suenaga <[email protected]> wrote:
>> src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java line
>> 301:
>>
>>> 299: } catch (MonitorException | URISyntaxException e) {
>>> 300: // Other exceptions (happened at MonitoredHost) would
>>> be wrapped with AttachOperationFailedException
>>> 301: throw new AttachOperationFailedException("Unable to
>>> find target proces", e);
>>
>> Would it be possible to paste in some examples of the cause?
>
> We would not see these exceptions TBH - they are just checked exceptions on
> `getMonitoredHost()` and `activeVms()`.
>
> `sun.jvmstat.perfdata.monitor.protocol.local.MonitoredHostProvider` would be
> instanciated by default when we pass `//localhost` to `getMonitoredHost()`.
> Both c'tor of `MonitoredHostProvider` and `activeVms()` do not have any
> `throws` clause. And also `MonitoredHostLocalService` which is loaded by
> ServiceLoader would not throw any exceptions.
>
> `URISyntaxException` comes from `URI` members, but it would not happen
> because `//localhost` is hard coded, and I believe it does not happen any
> exceptions on `URI`.
>
> The class inherits `MonitoredHost` might be instantiated by user-defined
> provider class of course, so these checked exceptions should be reported as
> the cause.
Can you please provide an example where IOException is thrown? The code in the
catch block to use MonitoredHost.getMonitoredHost is surprising (the only
dependency on jvmstat should be in the enumerate/list implementation).
If URISyntaxException is not possible then it would be okay to throw an
AssertionError or InternalError here.
It would be useful to get an example or two of when MonitorException is thrown.
That seems a reason candidate to wrap in an AttachOperationFailedException but
I think have a specific example or two would help the discussion.
It would be good to re-flow the comment in findTargetProcessTmpDirectory to
reduce the wildly long lines. Right now it is really hard to look at the
changes side-by-side.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29355#discussion_r2716641283