Find a strange problem about using project-panama on macos
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Mon Aug 14 09:35:21 UTC 2023
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 process1672 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/0e3690a9/attachment-0001.htm>
More information about the panama-dev
mailing list