Find a strange problem about using project-panama on macos
Sundararajan Athijegannathan
sundararajan.athijegannathan at oracle.com
Mon Aug 14 09:51:28 UTC 2023
Is this related ?
https://developer.apple.com/forums/thread/119429
"On macOS 10.14 libcrypto.dylib is a sym link to libcrypto.35.dylib
/usr/lib/libcrypto.dylib -> libcrypto.35.dylib"
Is that a symlink for you as well? Possible to try the versioned file as suggested in that Apple dev page?
-Sundar
________________________________
From: panama-dev <panama-dev-retn at openjdk.org> on behalf of Maurizio Cimadamore <maurizio.cimadamore at oracle.com>
Sent: 14 August 2023 15:05
To: 刘希晨 <benrush0705 at gmail.com>; panama-dev at openjdk.org <panama-dev at openjdk.org>
Subject: Re: Find a strange problem about using project-panama on macos
Does this happen if LibraryLookup is replaced by System.load ?
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.
Cheers
Maurizio
On 13/08/2023 19:42, 刘希晨 wrote:
I have found a really strange problem when using project-panama on macos, and it might be a bug.
Environment: JDK-21 ea build 34, cpu : M1 Pro, operating system : Ventura 13.5
Here are the minimal reproducible codes:
public class SimpleExample {
public static void main(String[] args) throws Throwable {
SymbolLookup crypto = SymbolLookup.libraryLookup("/Users/liuxichen/workspace/tenet-lib/lib/libcrypto.dylib", Arena.global());
Thread.sleep(Long.MAX_VALUE);
}
}
The libcrypto.dylib file is the OPENSSL dynamic library file, I think other libraries probably could cause the same problem.
Problem description:
A normal java program would work fine with jconsole and jmap, 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:
~/Dow/jdk-21/C/H/bin jps
1665 RemoteMavenServer36
2673 Jps
532
1671 Launcher
1672 SimpleExample
1211
~/Dow/jdk-21/C/H/bin ./jmap -histo:live,file=histo5.data 1672
Exception in thread "main" com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file /var/folders/k4/j5wzcbnd3m96s5lmqw_8lh8r0000gn/T/.java_pid1672: target process 1672 doesn't respond within 10500ms or HotSpot VM not loaded
at jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:95)
at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:58)
at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:207)
at jdk.jcmd/sun.tools.jmap.JMap.executeCommandForPid(JMap.java:127)
at jdk.jcmd/sun.tools.jmap.JMap.histo(JMap.java:199)
at jdk.jcmd/sun.tools.jmap.JMap.main(JMap.java:112)
Several tests:
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
2. The problem could be solved by adding VM options, for jconsole usable, add -Dcom.sun.management.jmxremote for jmap usable add -XX:+StartAttachListener , if there is no SymbolLookup.libraryLookup(), then jconsole and jmap would work well without these two arguments
So, I guess there must be some internal logic that blocks the jconsole and jmap from entering java program inside SymbolLookup.libraryLookup(), please correct me if I am wrong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230814/c9527cd1/attachment-0001.htm>
More information about the panama-dev
mailing list