Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The executable file built by GraalVM Oracle is larger than that of Liberica NIK, with one less .so file, and exits abnormally after running. #9738

Closed
imgoby opened this issue Sep 24, 2024 · 2 comments
Assignees
Labels

Comments

@imgoby
Copy link

imgoby commented Sep 24, 2024

Compared to GraalVM Oracle, the version is 17.0.12-graal,
And Liberica NIK, version 23.0.5.r17-nik
If the application uses AWT,
(1) The executable file of GraalVM Oracle after built is 333MB, and there are 9 dynamic link libraries: libattach.so libawt_headless.so libawt.so libawt_xawt.so libfontmanager.so libjavajpeg.so libjava.so libjvm.so liblcms.so

Running error:

19:50:26.273 logback [XNIO-1 task-2] INFO c.h.s.base.tools.SnowflakeIdWorker - getId,pointer:643242563,nextId=1838546531348668418
Fatal error reported via JNI: Could not allocate library name

Printing instructions (ip=0x0000000002117c49):
0x0000000002117b49: 0x10 0xeb 0x88 0x48 0x89 0x6c 0x24 0x40 0x48 0x89 0x54 0x24 0x38 0x48 0x89 0x4c
0x0000000002117b59: 0x24 0x30 0x4c 0x89 0x6c 0x24 0x28 0x4c 0x89 0x64 0x24 0x20 0x48 0x89 0x5c 0x24
0x0000000002117b69: 0x18 0x48 0xc7 0xc0 0x00 0x00 0x00 0x00 0x4c 0x8b 0x74 0x24 0x30 0x4c 0x8b 0x7c
0x0000000002117b79: 0x24 0x38 0x48 0x83 0xc4 0x48 0xc3 0x48 0x8b 0x6c 0x24 0x40 0x48 0x8b 0x54 0x24
0x0000000002117b89: 0x38 0x48 0x8b 0x4c 0x24 0x30 0x4c 0x8b 0x6c 0x24 0x28 0x4c 0x8b 0x64 0x24 0x20
0x0000000002117b99: 0x48 0x8b 0x5c 0x24 0x18 0x49 0x2b 0xc6 0x48 0xc1 0xe8 0x03 0x41 0x89 0x87 0xb4
0x0000000002117ba9: 0x00 0x00 0x00 0x41 0xc7 0x47 0x14 0x03 0x00 0x00 0x00 0xf0 0x83 0x04 0x24 0x00
0x0000000002117bb9: 0x48 0xc7 0xc0 0x00 0x00 0x00 0x00 0x4c 0x8b 0xf1 0x4c 0x8b 0xfa 0x48 0x83 0xc4
0x0000000002117bc9: 0x48 0xc3 0xcc 0xcc 0xcc 0xcc 0xcc 0x48 0x83 0xec 0x48 0x49 0x8b 0xce 0x49 0x8b
0x0000000002117bd9: 0xd7 0x48 0x85 0xff 0x0f 0x84 0x97 0x00 0x00 0x00 0x4c 0x8b 0xff 0x48 0x8b 0x47
0x0000000002117be9: 0x60 0x4c 0x8b 0xf0 0x66 0x66 0x90 0x41 0x83 0xbf 0xcc 0x00 0x00 0x00 0x00 0x0f
0x0000000002117bf9: 0x85 0xd6 0x00 0x00 0x00 0xb8 0x03 0x00 0x00 0x00 0x41 0xb8 0x01 0x00 0x00 0x00
0x0000000002117c09: 0xf0 0x45 0x0f 0xb1 0x47 0x14 0x90 0x0f 0x85 0xbe 0x00 0x00 0x00 0x48 0x89 0x6c
0x0000000002117c19: 0x24 0x40 0x48 0x89 0x54 0x24 0x38 0x48 0x89 0x4c 0x24 0x30 0x4c 0x89 0x6c 0x24
0x0000000002117c29: 0x28 0x4c 0x89 0x64 0x24 0x20 0x48 0x89 0x5c 0x24 0x18 0x48 0x8b 0xc7 0x4c 0x8b
0x0000000002117c39: 0xc6 0x48 0x89 0x44 0x24 0x08 0x4c 0x89 0x44 0x24 0x10 0xe8 0xa7 0xcf 0x0c 0x00

0x0000000002117c49: 0x90 0x41 0xc7 0x47 0x14 0x03 0x00 0x00 0x00 0xf0 0x83 0x04 0x24 0x00 0x48 0x8b
0x0000000002117c59: 0x5c 0x24 0x18 0x48 0x8b 0x6c 0x24 0x40 0x4c 0x8b 0x64 0x24 0x20 0x4c 0x8b 0x6c
0x0000000002117c69: 0x24 0x28 0x4c 0x8b 0x74 0x24 0x30 0x4c 0x8b 0x7c 0x24 0x38 0x48 0x83 0xc4 0x48
0x0000000002117c79: 0xc3 0x48 0x89 0x6c 0x24 0x40 0x48 0x89 0x54 0x24 0x38 0x48 0x89 0x4c 0x24 0x30
0x0000000002117c89: 0x4c 0x89 0x6c 0x24 0x28 0x4c 0x89 0x64 0x24 0x20 0x48 0x89 0x5c 0x24 0x18 0x48
0x0000000002117c99: 0x89 0x74 0x24 0x10 0x48 0x89 0x7c 0x24 0x08 0x48 0x8d 0x35 0xbf 0xf8 0x2b 0x12
0x0000000002117ca9: 0xbf 0x02 0x00 0x00 0x00 0x66 0x90 0xe8 0x8b 0xf9 0x04 0x00 0x90 0x48 0x8b 0x5c
0x0000000002117cb9: 0x24 0x18 0x48 0x8b 0x6c 0x24 0x40 0x4c 0x8b 0x64 0x24 0x20 0x4c 0x8b 0x6c 0x24
0x0000000002117cc9: 0x28 0x4c 0x8b 0x74 0x24 0x30 0x4c 0x8b 0x7c 0x24 0x38 0x48 0x89 0x6c 0x24 0x40
0x0000000002117cd9: 0x48 0x89 0x54 0x24 0x38 0x48 0x89 0x4c 0x24 0x30 0x4c 0x89 0x6c 0x24 0x28 0x4c
0x0000000002117ce9: 0x89 0x64 0x24 0x20 0x48 0x89 0x5c 0x24 0x18 0x48 0x89 0x74 0x24 0x10 0x48 0x89
0x0000000002117cf9: 0x7c 0x24 0x08 0xbf 0x01 0x00 0x00 0x00 0xbe 0x00 0x00 0x00 0x00 0xe8 0xe5 0xe1
0x0000000002117d09: 0x20 0x00 0x90 0x48 0x8b 0x74 0x24 0x10 0x48 0x8b 0x7c 0x24 0x08 0xe9 0x19 0xff
0x0000000002117d19: 0xff 0xff 0x48 0x8b 0x6c 0x24 0x40 0x48 0x8b 0x54 0x24 0x38 0x48 0x8b 0x4c 0x24
0x0000000002117d29: 0x30 0x4c 0x8b 0x6c 0x24 0x28 0x4c 0x8b 0x64 0x24 0x20 0x48 0x8b 0x5c 0x24 0x18
0x0000000002117d39: 0x49 0x2b 0xc6 0x48 0xc1 0xe8 0x03 0x41 0x89 0x87 0xb4 0x00 0x00 0x00 0x41 0xc7

Top of stack (sp=0x00007f0f827f9450):
0x00007f0f827f9430: 0x0000000000000000 0x0000000002117c49 0x00007f0f827f9450 0x0000000002117c49

0x00007f0f827f9450: 0x0000000000000000 0x00007f0f6c0008c0 0x00007f184daae8f8 0x00007f184daaf3d8
0x00007f0f827f9470: 0x0000000000000003 0x00007f0f827f94d0 0x0000000000000001 0x00007f0f6c0008c0
0x00007f0f827f9490: 0x00007f0f827fa510 0x00007f184daa64da 0x0000000000000fe7 0x00007f0f827f94de
0x00007f0f827f94b0: 0x00007f0f6c001280 0x00007f184d9fa000 0x00007f184da05df6 0x00007f184daa6250
0x00007f0f827f94d0: 0x61732f656d6f682f 0x6c2f7070612f6c69 0x65685f7477616269 0x732e7373656c6461
0x00007f0f827f94f0: 0x000000000000006f 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x00007f0f827f9510: 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x00007f0f827f9530: 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x00007f0f827f9550: 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x00007f0f827f9570: 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x00007f0f827f9590: 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x00007f0f827f95b0: 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x00007f0f827f95d0: 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x00007f0f827f95f0: 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x00007f0f827f9610: 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x00007f0f827f9630: 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000

VM thread locals for the failing thread 0x00007f0f6c0008c0:
0: JNIThreadLocalEnvironment.jniFunctions = (bytes) 0x00007f104f176f90
8: StackOverflowCheckImpl.stackBoundaryTL = (Word) 0x0000000000000001 (1)
16: Safepoint.safepointRequested = (int) 0x7fd91c01 (2144934913)
20: StatusSupport.statusTL = (int) 0x00000001 (1)
24: ThreadLocalAllocation.regularTLAB = (bytes)
0x00007f0f6c0008d8: 0x00007f1057f00000 0x00007f1058000000
0x00007f0f6c0008e8: 0x00007f1057f12708 0x0000000000000000
56: JavaFrameAnchors.lastAnchor = (Word) 0x00007f0f827fa538 (139704590640440)
64: PlatformThreads.currentVThreadId = (long) 0x0000000000000056 (86)
72: PlatformThreads.currentThread = (Object) 0x00007f1055a03750
is an object of type java.lang.Thread
80: SubstrateDiagnostics.threadOnlyAttachedForCrashHandler = (bytes) 0x0000000000000000
88: ThreadLocalAllocation.allocatedBytes = (Word) 0x00000000001fdf80 (2088832)
96: VMThreads.IsolateTL = (Word) 0x00007f104cd00000 (139707984904192)
104: VMThreads.OSThreadHandleTL = (Word) 0x00007f0f827fc700 (139704590649088)
112: VMThreads.OSThreadIdTL = (Word) 0x00007f0f827fc700 (139704590649088)
120: VMThreads.StackBase = (Word) 0x00007f0f827fd000 (139704590651392)
128: VMThreads.StackEnd = (Word) 0x00007f0f81ffe000 (139704582266880)
136: VMThreads.StartedByCurrentIsolate = (bytes) 0x0000000000000001
144: VMThreads.nextTL = (Word) 0x00007f0f780008c0 (139704414505152)
152: VMThreads.unalignedIsolateThreadMemoryTL = (Word) 0x00007f0f6c0008c0 (139704213178560)
160: AccessControlContextStack = (Object) 0x00007f1055930260
is an object of type java.util.ArrayDeque
164: ExceptionUnwind.currentException = (Object) 0x0000000000000000
168: IsolatedCompileClient.currentClient = (Object) 0x0000000000000000
172: IsolatedCompileContext.currentContext = (Object) 0x0000000000000000
176: JNIObjectHandles.handles = (Object) 0x00007f1055902000
is an object of type com.oracle.svm.core.handles.ThreadLocalHandles
180: JNIThreadLocalPendingException.pendingException = (Object) 0x0000000000000000
184: JNIThreadLocalPinnedObjects.pinnedObjectsListHead = (Object) 0x0000000000000000
188: JNIThreadOwnedMonitors.ownedMonitors = (Object) 0x0000000000000000
192: NoAllocationVerifier.openVerifiers = (Object) 0x0000000000000000
196: ThreadingSupportImpl.activeTimer = (Object) 0x0000000000000000
200: ActionOnExitSafepointSupport.actionTL = (int) 0x00000000 (0)
204: ActionOnTransitionToJavaSupport.actionTL = (int) 0x00000000 (0)
208: ImplicitExceptions.implicitExceptionsAreFatal = (int) 0x00000000 (0)
212: StackOverflowCheckImpl.yellowZoneStateTL = (int) 0x7efefefe (2130640638)
216: StatusSupport.safepointBehaviorTL = (int) 0x00000001 (1)
220: ThreadingSupportImpl.currentPauseDepth = (int) 0x00000000 (0)

Java frame anchors for the failing thread 0x00007f0f6c0008c0:
Anchor 0x00007f0f827fa538 LastJavaSP 0x00007f0f827fa520 LastJavaIP 0x00000000021dca70

Stacktrace for the failing thread 0x00007f0f6c0008c0 (A=AOT compiled, J=JIT compiled, D=deoptimized, i=inlined):
A SP 0x00007f0f827f9450 IP 0x0000000002117c49 size=80 com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FatalError_5ea28336426fe0a26a33d6b62307157f39a34d1c(IsolateEnterStub.java:0)
i SP 0x00007f0f827fa520 IP 0x00000000021dca70 size=64 com.oracle.svm.core.jni.JNIOnLoadFunctionPointer.invoke(JNILibraryInitializer.java)
A SP 0x00007f0f827fa520 IP 0x00000000021dca70 size=64 com.oracle.svm.core.jni.JNILibraryInitializer.callOnLoadFunction(JNILibraryInitializer.java:71)
A SP 0x00007f0f827fa560 IP 0x00000000021dcdf3 size=32 com.oracle.svm.core.jni.JNILibraryInitializer.initialize(JNILibraryInitializer.java:132)
A SP 0x00007f0f827fa580 IP 0x0000000002185610 size=96 com.oracle.svm.core.jdk.NativeLibrarySupport.addLibrary(NativeLibrarySupport.java:204)
A SP 0x00007f0f827fa5e0 IP 0x000000000218685f size=48 com.oracle.svm.core.jdk.NativeLibrarySupport.loadLibrary0(NativeLibrarySupport.java:160)
A SP 0x00007f0f827fa610 IP 0x0000000002186c96 size=96 com.oracle.svm.core.jdk.NativeLibrarySupport.loadLibraryRelative(NativeLibrarySupport.java:123)
i SP 0x00007f0f827fa670 IP 0x00000000045a2e3d size=32 java.lang.ClassLoader.loadLibrary(ClassLoader.java:50)

(2) After the build of Liberica NIK, it is 282MB with 10 dynamic link libraries:
libattach.so libawt_headless.so libawt.so libawt_xawt.so libfontmanager.so libfreetype.so libjavajpeg.so libjava.so libjvm.so liblcms.so, One more libfreetype.so

Running successfully.

Why?

@imgoby imgoby added the bug label Sep 24, 2024
@imgoby imgoby changed the title The executable file built by GraalVM Oracle is larger than that of Liberica NIK, with one less so file, and exits abnormally after running. The executable file built by GraalVM Oracle is larger than that of Liberica NIK, with one less .so file, and exits abnormally after running. Sep 24, 2024
@selhagani selhagani self-assigned this Sep 24, 2024
@fniephaus fniephaus self-assigned this Sep 25, 2024
@fniephaus
Copy link
Member

Hi @imgoby,
Thanks for opening this ticket. The reason this works on Liberica NIK is because it includes some reachability metadata for AWT applications, while Oracle GraalVM does not. We do not ship AWT metadata because that causes many different problems, one being that it leads to needlessly big images, and another one being that it's hard to provide accurate metadata that works all the time.
Currently, we recommend that you use the tracing agent to collect AWT metadata for your application. This will also include JNI and reflection registrations, which is ultimately what leads to the crash that you have reported. If you are building with Oracle GraalVM, you should by the way see a user recommendation about missing metadata for AWT.

Hope this helps and please let us know if you have any further questions.

-- Fabio

@imgoby
Copy link
Author

imgoby commented Sep 25, 2024

Thank you for your reply.I try to use the tracing agent to collect awt metadata first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants