Closed dylon closed 1 year ago
Did you try running with the tracing agent? It seems JNI tries to use an boolean array ([Z). You have to configure it for JNI usage. See https://docs.oracle.com/en/graalvm/enterprise/20/docs/reference-manual/native-image/BuildConfiguration/#embedding-a-configuration-file and https://docs.oracle.com/en/graalvm/enterprise/20/docs/reference-manual/native-image/JNI/#java-native-interface-jni-in-native-image
^1 Z boolean true or false [ type type[] https://stackoverflow.com/questions/38079081/l-z-and-v-in-java-method-signature
Thanks @SergejIsbrecht, that fixed one problem but now I get a segfault. Here are the steps I followed:
$ java -agentlib:native-image-agent=trace-output=config/trace-file.json -jar ./target/belex-g2-0.1.0-standalone.jar main.py
$ native-image -H:ConfigurationFileDirectories=config --native-image-info --verbose --report-unsupported-elements-at-runtime --initialize-at-build-time=com.gsitech,clojure,jep --no-fallback -jar ./target/belex-g2-0.1.0-standalone.jar -H:Name=./target/belex-g2
$ ./target/belex-g2 main.py
[ [ SubstrateSegfaultHandler caught a segfault in thread 0x00005564d51c7300 ] ]
siginfo: si_signo: 11, si_code: 2, si_addr: 0x00007f0fb3700038
Current timestamp: 1686932677134
General purpose register values:
RAX 0x00007f0fb3700000 is the heap base
RBX 0x00005564d51c7300 is a thread
RCX 0x0000000000000005 is an unknown value
RDX 0x0000000000000000
RBP 0x00007f0fb01466b0 is an unknown value
RSI 0x0000000200465878 is an unknown value
RDI 0x00005564d51c7300 is a thread
RSP 0x00007ffc2df58418 points into the stack for thread 0x00005564d51c7300
R8 0x00007f0fb1458da0 is an unknown value
R9 0x00007f0fb3b1f010 points into the image heap (read-only relocatables)
R10 0x00000000000a3148 is an unknown value
R11 0x0000000000000000
R12 0x0000000000000005 is an unknown value
R13 0x00007f0fb4132958 is an unknown value
R14 0x00007f0fb01466b0 is an unknown value
R15 0x00007f0fb4132970 is an unknown value
EFL 0x0000000000010206 is an unknown value
RIP 0x00005564d3260d0a points into AOT compiled code
Printing Instructions (ip=0x00005564d3260d0a):
0x00005564d3260cea: 0xff 0x60 0x48 0xcc 0xcc 0xcc 0x48 0x8b 0x87 0xb0 0x00 0x00 0x00 0x48 0x03 0xc1
0x00005564d3260cfa: 0xff 0x60 0x60 0xcc 0xcc 0xcc 0x48 0x8b 0x87 0xb0 0x00 0x00 0x00 0x48 0x03 0xc2
0x00005564d3260d0a: 0xff 0x60 0x38 0xcc 0xcc 0xcc 0x48 0x8b 0x87 0xb0 0x00 0x00 0x00 0x48 0x03 0xc1
0x00005564d3260d1a: 0xff 0x60 0x50 0xcc 0xcc 0xcc 0x48 0x83 0xec 0x78 0x4d 0x8b 0xc6 0x4d 0x8b 0xcf
Top of stack (sp=0x00007ffc2df58418):
0x00007ffc2df58418: 0x00007f0fb4114806 0x0000000000000000
0x00007ffc2df58428: 0x00007f0faac6136b 0x00005564d51c7300
0x00007ffc2df58438: 0x00007f0fb41cdcb3 0x0000000000000000
0x00007ffc2df58448: 0x69459fe99becee00 0x0000000000000000
0x00007ffc2df58458: 0xffffffffffffff88 0x0000000000000000
0x00007ffc2df58468: 0x00007f0fb430e5a0 0x00005564d51c7300
0x00007ffc2df58478: 0x00007f0faac6136b 0x00007f0fb1458da0
0x00007ffc2df58488: 0x00007f0fb01ba1f0 0x00007f0fb01c4840
0x00007ffc2df58498: 0x69459fe99becee00 0x00005564d51c7440
0x00007ffc2df584a8: 0x00005564d51e1d10 0x00007f0faac61348
0x00007ffc2df584b8: 0x00005564d51c7440 0x00005564d51c7300
0x00007ffc2df584c8: 0x00007f0faac6136b 0x00005564d51c7300
0x00007ffc2df584d8: 0x00007f0fb411a53d 0x00005564d51c7300
0x00007ffc2df584e8: 0x0000000000000004 0x00007f0faac61348
0x00007ffc2df584f8: 0x00005564d51e1d10 0x00007f0fb3700000
0x00007ffc2df58508: 0x00007f0fb411444c 0x000000102df58550
0x00007ffc2df58518: 0x0000000000000d79 0x0000000000000008
0x00007ffc2df58528: 0x00005564d356e96e 0x00007ffc2df58560
0x00007ffc2df58538: 0x00005564d356e981 0x00007f0fb3df15c0
0x00007ffc2df58548: 0x00007f0faac60da0 0x00007f0fb3501ea8
0x00007ffc2df58558: 0x00007f0fb3501130 0x00005564d356e96e
0x00007ffc2df58568: 0x00007ffc2df58540 0x0000000000000000
0x00007ffc2df58578: 0x0000000000000003 0x00007f0fb4114420
0x00007ffc2df58588: 0x00000001b3df15c0 0x00005564d51e1d10
0x00007ffc2df58598: 0x00005564d356eb48 0x00007f0fb3cf3c10
0x00007ffc2df585a8: 0x00007f0fb3501ea8 0x00007f0fb3a45c18
0x00007ffc2df585b8: 0x00007f0fb3501e70 0x00007f0faac60da0
0x00007ffc2df585c8: 0x00007f0fb3501130 0x00007f0fb3501ea8
0x00007ffc2df585d8: 0x00005564d31ed413 0x0000000000000000
0x00007ffc2df585e8: 0x00007f0fb3501ea8 0x00007f0fb3501e70
0x00007ffc2df585f8: 0x00005564d31ed2d6 0x0000000000000000
0x00007ffc2df58608: 0x00005564d31c2d15 0x0000000000000000
Top frame info:
TotalFrameSize in CodeInfoTable 8
Threads:
0x00007f0fa4000b80 STATUS_IN_NATIVE (ALLOW_SAFEPOINT) "JepMainInterpreter" - 0x00007f0fb3503770, daemon, stack(0x00007f0fb0401000,0x00007f0fb0c00000)
0x00007f0fac000b80 STATUS_IN_NATIVE (ALLOW_SAFEPOINT) "Reference Handler" - 0x00007f0fb3c81378, daemon, stack(0x00007f0fb2d01000,0x00007f0fb3500000)
0x00005564d51c7300 STATUS_IN_JAVA (PREVENT_VM_FROM_REACHING_SAFEPOINT) "main" - 0x00007f0fb3c812c0, stack(0x00007ffc2d75b000,0x00007ffc2df59000)
VM thread locals for the failing thread 0x00005564d51c7300:
0 (8 bytes): JNIThreadLocalEnvironment.jniFunctions = (bytes)
0x00005564d51c7300: 0x00007f0fb3b1f010
8 (8 bytes): StackOverflowCheckImpl.stackBoundaryTL = (Word) 1 (0x0000000000000001)
16 (4 bytes): Safepoint.safepointRequested = (int) 2146074083 (0x7fea7de3)
20 (4 bytes): StatusSupport.statusTL = (int) 1 (0x00000001)
24 (32 bytes): ThreadLocalAllocation.regularTLAB = (bytes)
0x00005564d51c7318: 0x00007f0faac00000 0x00007f0faad00000
0x00005564d51c7328: 0x00007f0faac62d80 0x0000000000000000
56 (8 bytes): PlatformThreads.currentThread = (Object) java.lang.Thread (0x00007f0fb3c812c0)
64 (8 bytes): JavaFrameAnchors.lastAnchor = (Word) 140721079551328 (0x00007ffc2df58560)
72 (8 bytes): AccessControlContextStack = (Object) java.util.ArrayDeque (0x00007f0fb35039e8)
80 (8 bytes): ExceptionUnwind.currentException = (Object) null
88 (8 bytes): IdentityHashCodeSupport.hashCodeGeneratorTL = (Object) java.util.SplittableRandom (0x00007f0faac60bf8)
96 (8 bytes): IsolatedCompileClient.currentClient = (Object) null
104 (8 bytes): IsolatedCompileContext.currentContext = (Object) null
112 (8 bytes): JNIObjectHandles.handles = (Object) com.oracle.svm.core.handles.ThreadLocalHandles (0x00007f0fb3501390)
120 (8 bytes): JNIThreadLocalPendingException.pendingException = (Object) java.lang.NoSuchMethodError (0x00007f0faac61c60)
128 (8 bytes): JNIThreadLocalPinnedObjects.pinnedObjectsListHead = (Object) com.oracle.svm.core.jni.JNIThreadLocalPinnedObjects$PinnedObjectListNode (0x00007f0faac61398)
136 (8 bytes): JNIThreadOwnedMonitors.ownedMonitors = (Object) null
144 (8 bytes): NoAllocationVerifier.openVerifiers = (Object) null
152 (8 bytes): ThreadingSupportImpl.activeTimer = (Object) null
160 (8 bytes): SubstrateDiagnostics.threadOnlyAttachedForCrashHandler = (bytes)
0x00005564d51c73a0: 0x0000000000000000
168 (8 bytes): ThreadLocalAllocation.allocatedBytes = (Word) 7310992 (0x00000000006f8e90)
176 (8 bytes): VMThreads.IsolateTL = (Word) 139705411698688 (0x00007f0fb3700000)
184 (8 bytes): VMThreads.OSThreadHandleTL = (Word) 139705422395200 (0x00007f0fb4133740)
192 (8 bytes): VMThreads.OSThreadIdTL = (Word) 139705422395200 (0x00007f0fb4133740)
200 (8 bytes): VMThreads.StackBase = (Word) 140721079554048 (0x00007ffc2df59000)
208 (8 bytes): VMThreads.StackEnd = (Word) 140721071173632 (0x00007ffc2d75b000)
216 (8 bytes): VMThreads.StartedByCurrentIsolate = (bytes)
0x00005564d51c73d8: 0x0000000000000000
224 (8 bytes): VMThreads.nextTL = (Word) 0 (0x0000000000000000)
232 (8 bytes): VMThreads.unalignedIsolateThreadMemoryTL = (Word) 93891560502000 (0x00005564d51c72f0)
240 (4 bytes): ActionOnExitSafepointSupport.actionTL = (int) 0 (0x00000000)
244 (4 bytes): ActionOnTransitionToJavaSupport.actionTL = (int) 0 (0x00000000)
248 (4 bytes): ImplicitExceptions.implicitExceptionsAreFatal = (int) 0 (0x00000000)
252 (4 bytes): StackOverflowCheckImpl.yellowZoneStateTL = (int) 2130640638 (0x7efefefe)
256 (4 bytes): StatusSupport.safepointBehaviorTL = (int) 1 (0x00000001)
260 (4 bytes): ThreadingSupportImpl.currentPauseDepth = (int) 0 (0x00000000)
No VMOperation in progress
The 15 most recent VM operation status changes (oldest first):
Counters:
Java frame anchors for the failing thread 0x00005564d51c7300:
Anchor 0x00007ffc2df58560 LastJavaSP 0x00007ffc2df58540 LastJavaIP 0x00005564d356e96e
Stacktrace for the failing thread 0x00005564d51c7300:
SP 0x00007ffc2df58418 IP 0x00005564d3260d0a com.oracle.svm.core.code.CodeInfo@0x7f0fb3c23f58 name = image code
SP 0x00007ffc2df58420 IP 0x00007f0fb4114806 IP is not within Java code. Aborting stack trace printing.
WARNING: stack pointer is NOT aligned to 16 bytes. Starting a stack walk in the most likely caller instead.
SP 0x00007ffc2df58420 IP 0x00007f0fb4114806 IP is not within Java code. Trying frame anchor of last Java frame instead.
SP 0x00007ffc2df58540 IP 0x00005564d356e96e [image code] jep.Jep.run(Jep.java)
SP 0x00007ffc2df585a0 IP 0x00005564d356eb48 [image code] jep.Jep.runScript(Jep.java:247)
SP 0x00007ffc2df585e0 IP 0x00005564d31ed413 [image code] com.gsitech.main$_main.invokeStatic(main.clj:9)
SP 0x00007ffc2df58600 IP 0x00005564d31ed2d6 [image code] com.gsitech.main$_main.doInvoke(main.clj:7)
SP 0x00007ffc2df58610 IP 0x00005564d31c2d15 [image code] clojure.lang.RestFn.applyTo(RestFn.java:137)
SP 0x00007ffc2df586f0 IP 0x00005564d31ec830 [image code] com.gsitech.Main.main(Unknown Source)
SP 0x00007ffc2df58710 IP 0x00005564d31f8481 [image code] com.oracle.svm.core.JavaMainWrapper.runCore0(JavaMainWrapper.java:180)
SP 0x00007ffc2df58740 IP 0x00005564d31f8135 [image code] com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:137)
SP 0x00007ffc2df58740 IP 0x00005564d31f8135 [image code] com.oracle.svm.core.JavaMainWrapper.doRun(JavaMainWrapper.java:237)
SP 0x00007ffc2df58770 IP 0x00005564d321904b [image code] com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:223)
SP 0x00007ffc2df58770 IP 0x00005564d321904b [image code] com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_3148eece06270530b6e0d4d60311411342c82698(IsolateEnterStub.java:0)
VM mutexes:
mutex "mainVMOperationControlWorkQueue" is unlocked.
mutex "referencePendingList" is unlocked.
mutex "thread" is unlocked.
AOT compiled code is mapped at 0x00005564d3171000 - 0x00005564d360183f
Heap settings and statistics:
Supports isolates: true
Heap base: 0x00007f0fb3700000
Object reference size: 8
Aligned chunk size: 1048576
Incremental collections: 0
Complete collections: 0
Native image heap boundaries:
ReadOnly Primitives: 0x00007f0fb3801028 - 0x00007f0fb39cc580
ReadOnly References: 0x00007f0fb39cc580 - 0x00007f0fb3b1e268
ReadOnly Relocatables: 0x00007f0fb3b1f000 - 0x00007f0fb3bb53e0
Writable Primitives: 0x00007f0fb3bb6000 - 0x00007f0fb3c359c8
Writable References: 0x00007f0fb3c359c8 - 0x00007f0fb3e455b0
Writable Huge: 0x00007f0fb3f00030 - 0x00007f0fb3f238b8
ReadOnly Huge: 0x00007f0fb3f24030 - 0x00007f0fb40e0b20
Heap:
Young generation:
Eden:
edenSpace:
aligned: 0/0 unaligned: 0/0
Survivors:
Survivor-1 From:
aligned: 0/0 unaligned: 0/0
Survivor-1 To:
aligned: 0/0 unaligned: 0/0
Survivor-2 From:
aligned: 0/0 unaligned: 0/0
Survivor-2 To:
aligned: 0/0 unaligned: 0/0
Survivor-3 From:
aligned: 0/0 unaligned: 0/0
Survivor-3 To:
aligned: 0/0 unaligned: 0/0
Survivor-4 From:
aligned: 0/0 unaligned: 0/0
Survivor-4 To:
aligned: 0/0 unaligned: 0/0
Survivor-5 From:
aligned: 0/0 unaligned: 0/0
Survivor-5 To:
aligned: 0/0 unaligned: 0/0
Survivor-6 From:
aligned: 0/0 unaligned: 0/0
Survivor-6 To:
aligned: 0/0 unaligned: 0/0
Survivor-7 From:
aligned: 0/0 unaligned: 0/0
Survivor-7 To:
aligned: 0/0 unaligned: 0/0
Survivor-8 From:
aligned: 0/0 unaligned: 0/0
Survivor-8 To:
aligned: 0/0 unaligned: 0/0
Survivor-9 From:
aligned: 0/0 unaligned: 0/0
Survivor-9 To:
aligned: 0/0 unaligned: 0/0
Survivor-10 From:
aligned: 0/0 unaligned: 0/0
Survivor-10 To:
aligned: 0/0 unaligned: 0/0
Survivor-11 From:
aligned: 0/0 unaligned: 0/0
Survivor-11 To:
aligned: 0/0 unaligned: 0/0
Survivor-12 From:
aligned: 0/0 unaligned: 0/0
Survivor-12 To:
aligned: 0/0 unaligned: 0/0
Survivor-13 From:
aligned: 0/0 unaligned: 0/0
Survivor-13 To:
aligned: 0/0 unaligned: 0/0
Survivor-14 From:
aligned: 0/0 unaligned: 0/0
Survivor-14 To:
aligned: 0/0 unaligned: 0/0
Survivor-15 From:
aligned: 0/0 unaligned: 0/0
Survivor-15 To:
aligned: 0/0 unaligned: 0/0
Old generation:
oldFromSpace:
aligned: 0/0 unaligned: 0/0
oldToSpace:
aligned: 0/0 unaligned: 0/0
Unused:
aligned: 0/0
Segfault detected, aborting process. Use runtime option -R:-InstallSegfaultHandler if you don't want to use SubstrateSegfaultHandler.
@dylon , I would suggest creating a new issue for the SegFault.
@dylon please create a new issue for the Segfault and we'll take a look into it.
Describe the issue I'm trying to create an executable using native-image that shares an environment between Clojure and JEP (Java Embedded Python). The executable compiles successfully, but immediately fails upon execution with the following:
I found this issue, which seems to describe my error, but it was closed without a solution I can follow: #2660. The issue that was cited as the reason for closure was subsequently closed with a fix commit, but I am still getting this error with GraalVM 22.3.2. Is there a quick fix for this or is this a bug?
Steps to reproduce the issue Please include both build steps as well as run steps
com/gsitech/main.clj
andcom/gsitech/my_type.clj
, and one Python source file,main.py
python -m venv venv && source venv/bin/activate
pip install jep==4.1.1
$HOME/.local/opt
export GRAALVM_HOME=$HOME/.local/opt/graalvm-ce-java11-22.3.2
export PATH="$GRAALVM_HOME/bin:$PATH"
export LD_LIBRARY_PATH="/usr/lib/jvm/java-11-openjdk/lib:/usr/lib/jvm/java-11-openjdk/lib/server:$PWD/venv/lib/python3.11/site-packages/jep"
lein do clean, uberjar
native-image --verbose --report-unsupported-elements-at-runtime --initialize-at-build-time=com.gsitech --initialize-at-build-time=clojure --initialize-at-build-time=jep --no-fallback -jar ./target/belex-g2-0.1.0-standalone.jar -H:Name=./target/belex-g2
Here are the sources:
Describe GraalVM and your environment:
More details Consider adding the
--native-image-info
and--verbose
flags when building your native image and paste output below.Add any other information about the problem here. Especially important are stack traces or log output. Feel free to link to gists or to screenshots if necessary.