<div dir="ltr"><div>Hi Ron,</div><div><br></div><div>Will this affect attaching via jcmd?</div><div><br></div><div>Thanks, Thomas<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 16, 2023 at 7:48 PM Ron Pressler <<a href="mailto:ron.pressler@oracle.com">ron.pressler@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi.<br>
<br>
In JDK 21 we intend to disallow the dynamic loading of agents by default. This<br>
will affect tools that use the Attach API to load an agent into a JVM some time<br>
after the JVM has started [1]. There is no change to any of the mechanisms that<br>
load an agent at JVM startup (-javaagent/-agentlib on the command line or the<br>
Launcher-Agent-Class attribute in the main JAR's manifest).<br>
<br>
This change in default behavior was proposed in 2017 as part of JEP 261 [2][3]. <br>
At that time the consensus was to switch to this default not in JDK 9 but in a <br>
later release to give tool maintainers sufficient time to inform their users. <br>
To allow the dynamic loading of agents, users will need to specify <br>
-XX:+EnableDynamicAgentLoading on the command line.<br>
<br>
I'll post a draft JEP for review shortly.<br>
<br>
-- Ron<br>
<br>
[1]: <a href="https://docs.oracle.com/en/java/javase/19/docs/api/jdk.attach/com/sun/tools/attach/package-summary.html" rel="noreferrer" target="_blank">https://docs.oracle.com/en/java/javase/19/docs/api/jdk.attach/com/sun/tools/attach/package-summary.html</a><br>
[2]: <a href="https://openjdk.org/jeps/261" rel="noreferrer" target="_blank">https://openjdk.org/jeps/261</a><br>
[3]: <a href="https://mail.openjdk.org/pipermail/jigsaw-dev/2017-April/012040.html" rel="noreferrer" target="_blank">https://mail.openjdk.org/pipermail/jigsaw-dev/2017-April/012040.html</a></blockquote></div>