Search code examples
javajava-native-interface

What does "consider using jsig library" mean?


I'm running a Java program which uses JNI with the -Xcheck:jni flag, and I'm getting messages that look like this:

SIGSEGV: [libjvm.so+0x6fd190], sa_mask[0]=0x00000400, sa_flags=0x10000000, flags was changed from 0x10000004, consider using jsig library

What does that mean? Should I be concerned? What is the jsig library?

I'm using Java 7 on Linux, or to be exact:

JRE version: 7.0_03-b04
Java VM: Java HotSpot(TM) 64-Bit Server VM (22.1-b02 mixed mode linux-amd64 compressed oops)

Solution

  • As your question seemed intriguing, I took a fast google search and found that page concerning JNA. To quote it

    VM Crash Protection

    It is not uncommon when defining a new library and writing tests to encounter memory access errors which crash the VM. These are often caused by improper mappings or invalid arguments passed to the native library. To generate Java errors instead of crashing the VM, call Native.setProtected(true). Not all platforms support this protection; if not, the value of Native.isProtected() will remain false. NOTE: When protected mode is enabled, you should make use of the jsig library, if available (see Signal Chaining) to avoid interfering with the JVM's use of signals. In short, set the environment variable LD_PRELOAD (or LD_PRELOAD_64) to the path to libjsig.so in your JRE lib directory (usually ${java.home}/lib/${os.arch}/libjsig.so) before launching your Java application.

    So, from what I guess, the jsig library should be available "somewhere" in your Java installation directory.