eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.28k stars 721 forks source link

AIX Semeru 11.0.16.1 - OpenJ9 0.33.0 JNI call failure #15901

Closed silviu-nanau closed 2 years ago

silviu-nanau commented 2 years ago

We are using JNI from a graphical application on AIX 7.2.

Semeru 11.0.16.1 OpenJDK 11.0.16.1+1 OpenJ9 0.33.1

We replicated the problem using a sample application. The JNI calls a simple C++ function - std::getline which fails. Interesting is that from a command line application (no swing) the same call works.

This worked in: Semeru 11.0.14.1 OpenJDK 11.0.14.1+1 OpenJ9 0.30.1

pshipton commented 2 years ago

The compiler changed for AIX from xlc 13 to xlc 16.1. Did you recompile your JNI with xlc 16.1?

silviu-nanau commented 2 years ago

Hello,

We are compiling the JNI library with gcc:

gcc -v

Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/freeware/libexec/gcc/powerpc-ibm-aix7.1.0.0/9.3.1/lto-wrapper Target: powerpc-ibm-aix7.1.0.0 Configured with: ../gcc-9.3.1-20200408/configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=c,c++ --prefix=/opt/freeware --mandir=/opt/freeware/man --infodir=/opt/freeware/info --enable-version-specific-runtime-libs --disable-nls --enable-decimal-float=dpd --enable-bootstrap --build=powerpc-ibm-aix7.1.0.0 Thread model: aix gcc version 9.3.1 20200408 (GCC)

With any older version of Semeru the JNI calls work.

pshipton commented 2 years ago

Maybe gcc isn't compatible with xlc 16.1. Does it work if you compile with xlc 16.1?

silviu-nanau commented 2 years ago

Hello,

We don't have license for xlc, that's why we are using gcc and providing the runtime libraries. We tried using Java 17 as an alternative, but we get the same error.

JAVA_HOME_TEST has the value: /opt/java/jdk-17.0.4.1+1-jre/bin/java terminate called after throwing an instance of 'std::bad_cast' Unhandled exception Type=Illegal instruction vmState=0x00040000 J9Generic_Signal_Number=00000048 Signal_Number=00000004 Error_Value=00000000 Signal_Code=0000001e Handler1=09001000A09929B8 Handler2=09001000A094A4E8 R0=0900000012FB4E54 R1=00000100228439B0 R2=0000000000000000 R3=09001000A0D324A8 R4=FFFFFFFFFFFF8800 R5=FFFFFFFFFFFF8728 R6=0000000000000002 R7=0000000000000001 R8=0000010022A0B400 R9=0000000000000000 R10=0000000000000000 R11=0000000000000000 R12=0000000082000228 R13=000001002284F800 R14=00000000303CDB70 R15=00000100228444E0 R16=0000000000000001 R17=09001000A092BF90 R18=0000000000000001 R19=00000100220E94D6 R20=0000000000000000 R21=0000000000000000 R22=0000000000000001 R23=00000000303CDB78 R24=08001000A0211488 R25=0000000000000000 R26=0900000012FB00C0 R27=0000000000000000 R28=090000001317BAC0 R29=0000010022059B10 R30=09001000A0004730 R31=09001000A0D324D8 IAR=0000000000000000 LR=0900000012FB4E74 MSR=A00000000200D032 CTR=0000000000000000 CR=2800022B00000002 FPSCR=8200000000000000 XER=0000000282000000 FPR0 0000000000000001 (f: 1.000000, d: 4.940656e-324) FPR1 c3e0000000000000 (f: 0.000000, d: -9.223372e+18) FPR2 3ff0000000000000 (f: 0.000000, d: 1.000000e+00) FPR3 43300000000437fa (f: 276474.000000, d: 4.503600e+15) FPR4 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR5 4330000000000000 (f: 0.000000, d: 4.503600e+15) FPR6 4110dfe800000000 (f: 0.000000, d: 2.764740e+05) FPR7 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR8 be7eacb1fc825b17 (f: 4236401408.000000, d: -1.142718e-07) FPR9 3f4627630f696800 (f: 258566144.000000, d: 6.760820e-04) FPR10 402eac3ae1f314f8 (f: 3790804224.000000, d: 1.533639e+01) FPR11 3fd55555555450ef (f: 1431589120.000000, d: 3.333333e-01) FPR12 4530000000000000 (f: 0.000000, d: 1.934281e+25) FPR13 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR14 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR15 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR16 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR17 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR18 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR19 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR20 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR21 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR22 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR23 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR24 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR25 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR26 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR27 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR28 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR29 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR30 0000000000000000 (f: 0.000000, d: 0.000000e+00) FPR31 0000000000000000 (f: 0.000000, d: 0.000000e+00) Target=2_90_20220811_240 (AIX 7.2) CPU=ppc64 (8 logical CPUs) (0x100000000 RAM) ----------- Stack Backtrace ----------- _ZN10cxxabiv111terminateEPFvvE+0x20 (0x0900000012FC2E60 [libstdc++.a+0x10d60]) _ZSt9terminatev (0x0900000012FB4C48 [libstdc++.a+0x2b48]) cxa_throw+0x6c (0x0900000012FC2A7C [libstdc++.a+0x1097c]) _ZSt16throw_bad_castv (0x0900000012FC4B80 [libstdc++.a+0x12a80]) _Z15readLicenseFileRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERSt6vectorIS4_SaIS4_EE+0x5b4 (0x0900000012FAF11C [libJniDll.so+0x111c]) Java_JniInterface_testJavaJNI+0xcc (0x0900000012FAF394 [libJniDll.so+0x1394]) (0x090000000602DCBC [libj9vm29.so+0xdbcbc]) ffi_call+0xfc (0x090000000602CDE0 [libj9vm29.so+0xdade0]) (0x090000000618FA30 [libj9vm29.so+0x23da30]) (0x0900000005FDB768 [libj9vm29.so+0x89768]) runJavaThread+0x25c (0x0900000005FC45E0 [libj9vm29.so+0x725e0]) _ZL23javaProtectedThreadProcP13J9PortLibraryPv+0x11c (0x0900000005F54EC0 [libj9vm29.so+0x2ec0]) omrsig_protect+0x4cc (0x0900000006329A70 [libj9prt29.so+0x5ca70]) javaThreadProc+0x68 (0x0900000005F54D2C [libj9vm29.so+0x2d2c]) thread_wrapper+0x558 (0x090000000639269C [libj9thr29.so+0x569c]) _pthread_body+0xe8 (0x09000000005ABFEC [libpthreads.a+0x3fec])

JVMDUMP039I Processing dump event "gpf", detail "" at 2022/09/27 19:15:57 - please wait. JVMDUMP032I JVM requested System dump using '/tmp/JniTest/demo/core.20220927.191557.23593438.0001.dmp' in response to an event Note: "Enable full CORE dump" in smit is set to FALSE and as a result there will be limited threading information in core file. readLicenseFile...JVMDUMP010I System dump written to /tmp/JniTest/demo/core.20220927.191557.23593438.0001.dmp JVMDUMP032I JVM requested Java dump using '/tmp/JniTest/demo/javacore.20220927.191557.23593438.0002.txt' in response to an event JVMDUMP010I Java dump written to /tmp/JniTest/demo/javacore.20220927.191557.23593438.0002.txt JVMDUMP032I JVM requested Snap dump using '/tmp/JniTest/demo/Snap.20220927.191557.23593438.0003.trc' in response to an event JVMDUMP010I Snap dump written to /tmp/JniTest/demo/Snap.20220927.191557.23593438.0003.trc JVMDUMP032I JVM requested JIT dump using '/tmp/JniTest/demo/jitdump.20220927.191557.23593438.0004.dmp' in response to an event JVMDUMP051I JIT dump occurred in 'AWT-EventQueue-0' thread 0x00000000303BFE00 JVMDUMP010I JIT dump written to /tmp/JniTest/demo/jitdump.20220927.191557.23593438.0004.dmp JVMDUMP013I Processed dump event "gpf", detail "".

We suspect there is an issue with the JNI C++ I/O interface.

Thank you! Silviu

pshipton commented 2 years ago

Java 17 is also compiled with xlC 16.1 gcc is not supported. I expect it's an incompatibility between gcc and xlC, nothing to do with JNI itself. Using C instead of C++ should work fine.