Self attach fails on macOS / Eclipse Temurin

Aleksey Shipilev shade at redhat.com
Tue Oct 18 18:14:00 UTC 2022


On 10/15/22 13:32, Markus Heiden wrote:
> I am using jol-core under macOS 12.6 with Eclipse Temurin 19
> -Djdk.attach.allowAttachSelf -Djol.tryWithSudo=true and it is not able
> to attach itself:
> 
> WARNING: Unable to attach Serviceability Agent. Unable to attach even
> with escalated privileges: sudo: a terminal is required to read the
> password; either use the -S option to read from standard input or
> configure an askpass helper
> sudo: a password is required
> 
> When manuall executing SenseAccessMain sun.jvm.hotspot.runtime.VM cannot
> be found and it thus exits with code 1:
> java.lang.ClassNotFoundException: sun.jvm.hotspot.runtime.VM

It is possible Serviceability Agent (SA) is not shipped with that JDK.

> Am I missing some point or do I really need to start my app as root?

You don't need to start with Serviceability Agent (SA) to get most out of the JOL. SA is there to 
poll some of the things from VM directly, without guessing. But the overwhelming majority of the 
time, JOL guesses correctly.

I also see modern JDK reshuffled SA code a little bit, so current JOL fails there. I'll try to see 
if that code can be salvages somehow. Meanwhile, just trust JOL data without SA.

-- 
Thanks,
-Aleksey



More information about the jol-dev mailing list