<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Is this related ?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
<a href="https://developer.apple.com/forums/thread/119429" id="LPlnk174063">https://developer.apple.com/forums/thread/119429</a><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0">
"<span style="font-family: -apple-system, "SF Pro Text", "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif; letter-spacing: -0.078px; orphans: 2; widows: 2; font-size: 12pt; color: rgb(51, 51, 51);">On macOS 10.14 libcrypto.dylib is a sym link to
libcrypto.35.dylib</span>
<p style="text-decoration: none; margin: 0.8em 0px 0px; line-height: 1.33; tab-size: 4; word-break: break-word; font-family: -apple-system, "SF Pro Text", "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif; letter-spacing: -0.078px; orphans: 2; text-align: left; widows: 2; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255);" class="ContentPasted1">
/usr/lib/libcrypto.dylib -> libcrypto.35.dylib"</p>
<p style="text-decoration: none; margin: 0.8em 0px 0px; line-height: 1.33; tab-size: 4; word-break: break-word; font-family: -apple-system, "SF Pro Text", "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif; letter-spacing: -0.078px; orphans: 2; text-align: left; widows: 2; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255);" class="ContentPasted1">
<br>
</p>
<p style="text-decoration: none; margin: 0.8em 0px 0px; line-height: 1.33; tab-size: 4; word-break: break-word; font-family: -apple-system, "SF Pro Text", "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif; letter-spacing: -0.078px; orphans: 2; text-align: left; widows: 2; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255);" class="ContentPasted1">
Is that a symlink for you as well? Possible to try the versioned file as suggested in that Apple dev page?</p>
<p style="text-decoration: none; margin: 0.8em 0px 0px; line-height: 1.33; tab-size: 4; word-break: break-word; font-family: -apple-system, "SF Pro Text", "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif; letter-spacing: -0.078px; orphans: 2; text-align: left; widows: 2; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255);" class="ContentPasted1">
<br>
</p>
<p style="text-decoration: none; margin: 0.8em 0px 0px; line-height: 1.33; tab-size: 4; word-break: break-word; font-family: -apple-system, "SF Pro Text", "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif; letter-spacing: -0.078px; orphans: 2; text-align: left; widows: 2; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255);" class="ContentPasted1">
-Sundar</p>
<p style="text-decoration: none; margin: 0.8em 0px 0px; line-height: 1.33; tab-size: 4; word-break: break-word; font-family: -apple-system, "SF Pro Text", "Helvetica Neue", HelveticaNeue, Helvetica, Arial, sans-serif; letter-spacing: -0.078px; orphans: 2; text-align: left; widows: 2; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255);" class="ContentPasted1">
<br>
</p>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> panama-dev <panama-dev-retn@openjdk.org> on behalf of Maurizio Cimadamore <maurizio.cimadamore@oracle.com><br>
<b>Sent:</b> 14 August 2023 15:05<br>
<b>To:</b> ÁõÏ£³¿ <benrush0705@gmail.com>; panama-dev@openjdk.org <panama-dev@openjdk.org><br>
<b>Subject:</b> Re: Find a strange problem about using project-panama on macos</font>
<div> </div>
</div>
<div>
<p>Does this happen if LibraryLookup is replaced by System.load ?</p>
<p>IIRC, the code that underlies LibraryLookup is fairly similar to the one already used by the JDK, so perhaps there might be a more general issue.</p>
<p>Cheers<br>
Maurizio<br>
</p>
<div class="x_moz-cite-prefix">On 13/08/2023 19:42, ÁõÏ£³¿ wrote:<br>
</div>
<blockquote type="cite">
<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 {
<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 {
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>());
Thread.<span style="font-style:italic">sleep</span>(Long.<span style="color:rgb(199,125,187); font-style:italic">MAX_VALUE</span>);
}
}</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
<span style="color:rgb(42,172,184)">2673 </span>Jps
<span style="color:rgb(42,172,184)">532
</span><span style="color:rgb(42,172,184)">1671 </span>Launcher
<span style="color:rgb(42,172,184)">1672 </span>SimpleExample
<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
</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>)
at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:<span style="color:rgb(42,172,184)">58</span>)
at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:<span style="color:rgb(42,172,184)">207</span>)
at jdk.jcmd/sun.tools.jmap.JMap.executeCommandForPid(JMap.java:<span style="color:rgb(42,172,184)">127</span>)
at jdk.jcmd/sun.tools.jmap.JMap.histo(JMap.java:<span style="color:rgb(42,172,184)">199</span>)
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="">-Dcom.sun.management.jmxremote</span> for jmap usable add <span style="">-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>
</blockquote>
</div>
</body>
</html>