<div dir="ltr"><br><div>I have found a really strange problem when using project-panama on macos, and it might be a bug.</div><div><br></div><div><b>Environment</b>: JDK-21 ea build 34, cpu : M1 Pro, operating system : Ventura 13.5</div><div><br></div><div>Here are the minimal reproducible codes:</div><div><br></div><div><pre style="color:rgb(188,190,196);font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(207,142,109)">public class </span>SimpleExample {<br>    <span style="color:rgb(207,142,109)">public static void </span><span style="color:rgb(86,168,245)">main</span>(String[] args) <span style="color:rgb(207,142,109)">throws </span>Throwable {<br>        SymbolLookup crypto = SymbolLookup.<span style="font-style:italic">libraryLookup</span>(<span style="color:rgb(106,171,115)">"/Users/liuxichen/workspace/tenet-lib/lib/libcrypto.dylib"</span>, Arena.<span style="font-style:italic">global</span>());<br>        Thread.<span style="font-style:italic">sleep</span>(Long.<span style="color:rgb(199,125,187);font-style:italic">MAX_VALUE</span>);<br>    }<br>}</pre></div><div>The libcrypto.dylib file is the OPENSSL dynamic library file, I think other libraries probably could cause the same problem.</div><div><br></div><div><b>Problem description</b>: </div><div>A normal java program would work fine with <b>jconsole</b> and <b>jmap</b>, if running the above code in macos, jconsole won't be able to connect to the target process, and jmap will give the following error:</div><div><br></div><div> <b>~/Dow/jdk-21/C/H/bin  jps</b>                     </div><div><div style="background-color:rgb(30,31,34);color:rgb(188,190,196)"><pre style="font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(42,172,184)">1665 </span>RemoteMavenServer36<br><span style="color:rgb(42,172,184)">2673 </span>Jps<br><span style="color:rgb(42,172,184)">532<br></span><span style="color:rgb(42,172,184)">1671 </span>Launcher<br><span style="color:rgb(42,172,184)">1672 </span>SimpleExample<br><span style="color:rgb(42,172,184)">1211</span></pre></div></div><div><br></div><div><b> ~/Dow/jdk-21/C/H/bin  ./jmap -histo:live,file=histo5.data 1672</b></div><div><div style="background-color:rgb(30,31,34);color:rgb(188,190,196)"><pre style="font-family:"JetBrains Mono",monospace;font-size:9.8pt">Exception in thread <span style="color:rgb(106,171,115)">"main" </span>com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file /var/folders/k4/j5wzcbnd3m96s5lmqw_8lh8r0000gn/T/.java_pid1672: target process <span style="color:rgb(42,172,184)">1672 </span>doesn<span style="color:rgb(106,171,115)">'t respond within 10500ms or HotSpot VM not loaded<br></span><span style="color:rgb(106,171,115)">    </span>at jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:<span style="color:rgb(42,172,184)">95</span>)<br>    at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:<span style="color:rgb(42,172,184)">58</span>)<br>    at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:<span style="color:rgb(42,172,184)">207</span>)<br>    at jdk.jcmd/sun.tools.jmap.JMap.executeCommandForPid(JMap.java:<span style="color:rgb(42,172,184)">127</span>)<br>    at jdk.jcmd/sun.tools.jmap.JMap.histo(JMap.java:<span style="color:rgb(42,172,184)">199</span>)<br>    at jdk.jcmd/sun.tools.jmap.JMap.main(JMap.java:<span style="color:rgb(42,172,184)">112</span>)</pre></div></div><div><br></div><div>Several tests:</div><div>1. The above code runs fine on windows and macos, and the process could be accessed by jconsole and jmap on windows, only fail on macos</div><div>2. The problem could be solved by adding VM options, for jconsole usable, add <span style="font-family:"JetBrains Mono",monospace;font-size:9.8pt;background-color:rgb(30,31,34);color:rgb(188,190,196)">-Dcom.sun.management.jmxremote</span> for jmap usable add <span style="font-family:"JetBrains Mono",monospace;font-size:9.8pt;background-color:rgb(30,31,34);color:rgb(188,190,196)">-XX:+StartAttachListener</span> , if there is no <b>SymbolLookup.libraryLookup</b>(), then jconsole and jmap would work well without these two arguments</div><div><br></div><div>So, I guess there must be some internal logic that blocks the jconsole and jmap from entering java program inside <b>SymbolLookup.libraryLookup</b>(), please correct me if I am wrong</div><div><br></div><div><br></div><div><br></div></div>