Using Intel's MKL C++ Library in JNI causes JVM to Crash at GC
843829Jan 5 2009 — edited Jul 16 2009We're using JDK 1.6.0_07 on RedHat 4 (32-bit) and RedHat 5 (32-bit JVM on 64-bit processor). Our app uses JNI to access Intel's Math Kernel Library (MKL) for optimized algorithms; however, it crashes in libjvm.so/libpthread.so in the GC thread once the garbage collector runs (usually pretty quick).
The MKL library uses it's own threading model built on pthreads. So, the basic flow goes like this:
A Java GUI spawns a separate thread to:
1) Call native method to initialize settings and allocate buffers
2) Call native method to load data (using mapped buffers)
3) Call native method to process data
4) Call native method to unload data back into mapped buffers
It seems like the MKL threading model (parallel processing) is causing issues with the JVM. Is there a safe way to call a MT native method? BTW, the native code never calls back into Java.