<div dir="ltr"><div>Thank you for the clarification.</div><div><br></div><div>Oddly enough, -XX:-EnableDynamicAgentLoading seems to be broken. Tried head (fastdebug, release) and JDK17, even with this switch my sample library loads just fine:<br></div><div><br></div><div>```<br></div><div>thomas@starfish$ ./images/jdk/bin/java -XX:-EnableDynamicAgentLoading -XX:+PrintFlagsFinal  -cp $REPROS_JAR de.stuefe.repros.Simple                                                                                               <br>[Global flags]                                                                                                                            <br></div><div>...<br></div><div>     bool EnableDynamicAgentLoading                = false                                     {product} {command line}<br></div><div>...</div><div><press key><br>OnAttach! Loading JVMTI sample agent<br></div><div>```</div><div><br></div><div>Investigation shows that there seems to be a bug in attachListener.cpp where we compare AttachOperation::name for "load", but it contains "jcmd": <br></div><div><br></div><div>```<br></div><div>Thread 22 "Attach Listener" hit Breakpoint 1, attach_listener_thread_entry (thread=0x7fff94000fd0, __the_thread__=0x7fff94000fd0) at /shared/projects/openjdk/jdk-jdk/source/src/hotspot/share/services/attachListener.cpp:404<br>404         } else if (!EnableDynamicAgentLoading && strcmp(op->name(), "load") == 0) {<br>(gdb) p op<br>$1 = (AttachOperation *) 0x7fff7401b640<br>(gdb) p *op<br>$2 = {<CHeapObj<(MEMFLAGS)9>> = {<No data fields>}, _vptr.AttachOperation = 0x7ffff7b61210 <vtable for LinuxAttachOperation+16>, _name = "jcmd\000", '\361' <repeats 11 times>, <incomplete sequence \361>, _arg = {<br>    "JVMTI.agent_load /shared/projects/jvmti-sample/sample.so\000", '\361' <repeats 967 times>..., "\000", '\361' <repeats 1023 times>..., "\000", '\361' <repeats 1023 times>...}}</div><div>(gdb) p op->name()<br>$3 = 0x7fff7401b648 "jcmd"<br></div><div>```</div><div><br></div><div>This was on Linux x64.</div><div><br></div><div>So if people have been using -XX:-EnableDynamicAgentLoading to check their code, this may not have worked as intended.</div><div><br></div><div>Cheers, Thomas<br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 17, 2023 at 2:42 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">



<div style="overflow-wrap: break-word;">
<br>
<div><br>
<blockquote type="cite">
<div>On 17 Mar 2023, at 13:33, Thomas Stüfe <<a href="mailto:thomas.stuefe@gmail.com" target="_blank">thomas.stuefe@gmail.com</a>> wrote:</div>
<br>
<div>
<div dir="ltr">
<div>Hi Ron,</div>
<div><br>
</div>
<div>Will this affect attaching via jcmd?</div>
</div>
</div>
</blockquote>
<br>
</div>
<div>
<div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue"">
The Attach mechanism will not be disabled by default, just the ability to load agents via the Attach mechanism. </div>
<div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue"">
So the only jcmd command that will be affected is JVMTI.agent_load.</div>
<div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue"">
<br>
</div>
<div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue"">
To see the effect of the change today, launch java with -XX:-EnableDynamicAgentLoading, which is</div>
<div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue"">
to become the new default.</div>
<div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue"">
<br>
</div>
<div style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:"Helvetica Neue"">
— Ron</div>
</div>
<br>
</div>

</blockquote></div>