JDK-4418559 : JNI_CreateJavaVM causes segmentation fault
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_7
  • CPU: sparc
  • Submitted: 2001-02-23
  • Updated: 2012-11-02
  • Resolved: 2001-03-02
Related Reports
Duplicate :  
Description

Name: yyT116575			Date: 02/23/2001


/dskaol01/s72_dev/pegdevbin/bin> java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)

This bug seems to have very similar symptoms to #4411392, but the recommended
steps stated there do not solve the problem.

Error:
#
# HotSpot Virtual Machine Error, Internal Error
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
#
t@1 (l@1) signal SEGV (no mapping at the fault address) in
__1cSThreadLocalStorageUget_thread_via_cache6F_pnGThread
__ at 0xfd65706c               0xfd65706c:
__1cSThreadLocalStorageUget_thread_via_cache6F_pnGThread__+0x005c:
ld      [%l0 + 0x64], %g2

Stack trace:
(dbx) where
current thread: t@1
  [1] __1cSThreadLocalStorageUget_thread_via_cache6F_pnGThread__(0xfd773b44, 0xfd7897c4, 0x8, 0xffbea, 0xfd773b44, 0xffbeacdc), at 0xfd65706c
  [2] __1cMreport_error6Flpkci11E_v_(0xe4, 0xffbeb55c, 0x751, 0xfd73062c, 0xfd7aadbc, 0xfd773b44), at 0xfd4e4c1c
  [3] __1cMreport_fatal6Fpkci1E_v_(0x751, 0xfd773b44, 0xfd741b2c, 0xfee61888, 0xb, 0x39a48), at 0xfd4e46a8
  [4] __1cJos_init_26F_l_(0x1, 0xfd7aadbc, 0xfd7894c8, 0xfd773b44, 0xfd773b44, 0x0), at 0xfd5f0cd8
  [5] __1cHThreadsJcreate_vm6FpnOJavaVMInitArgs__l_(0xfcb7672c, 0xfd780644, 0x0, 0xfd773b44, 0xfd74bd9c, 0x0), at 0xfd6545e8
  [6] JNI_CreateJavaVM(0xfd780644, 0xffffffff, 0xfcb7672c, 0xfd773b44, 0xfcb76724, 0xfcb76728), at 0xfd569640
  [7] connect(0x0, 0x194, 0xfcb7555c, 0xfcb76278, 0x0, 0xfcb75f44), at 0xfcb64e14
  [8] run_java_class(0xffbecfec, 0xfcb76288, 0xfcb7555c, 0x0, 0x47415049, 0x44495343), at 0xfcb64f78
  [9] execute(0xffbecfec, 0xffbecfec, 0x0, 0x1ac, 0xfcb7555c, 0xfcb75b50), at 0xfcb64a58
  [10] execute(0xad8ba, 0xffbed970, 0x14, 0x0, 0x0, 0xfca9ceb8), at 0xfcb626fc
  [11] Execute(0xffbed84c, 0x0, 0x80, 0xc8f78, 0x0, 0xe4210), at 0xfca9c5fc
  [12] zisfusr_execute(0xad8ba, 0xffbedce4, 0xffbee32c, 0x0, 0x0, 0xfcab7688), at 0xfca9b304
  [13] direct_execute(0xffbee1c4, 0xfcb462f1, 0xffffffff, 0x0, 0x0, 0xffbee339), at 0xfcab045c
  [14] zlkcmnd(0xffbeeb4c, 0x0, 0x0, 0x0, 0x0, 0x0), at 0xfcaad1e4
=>[15] zlkvect_call_connect_ppt(pptIndex = 0, p_cwa = 0xae8b8), line 128 in "zlkvect.cxx"
  [16] ypdshel(p_cwa = 0xae8b8), line 224 in "zisfacc.cxx"
  [17] zisfacc(p_cwa = 0xae8b8), line 221 in "zisfacc.cxx"
  [18] zpdcall_lcl(pgm_name = CLASS, p_cwa = 0xae8b8, disp_flag = 1, p_cicsp = 0x41080), line 221 in "zpdcall.cxx"
  [19] zpdcalx(), line 172 in "zpdcall.cxx"
  [20] ycx_init_term(the_mode = '\002', mainline = 0x14080 = &`zcxpson`zcxpson.cxx`mainline(void), mainline_prms = (nil), argc = 2, argv = 0xffbeef7c), line 647 in "ycxonx.cxx"
  [21] zcxonyt(yz_mainline = 0x14080 = &`zcxpson`zcxpson.cxx`mainline(void), argc = 2, argv = 0xffbeef7c), line 75 in "zcxxmain.h"
  [22] main(argc = 2, argv = 0xffbeef7c), line 87 in "zcxpson.cxx"

C++ code:
if (stat == PEG_RC_GOOD) {
	
  // get the CLASSPATH from the environment
  strcpy(classpath_str, "-Djava.class.path=");
  classpath_env = getenv("CLASSPATH");
  if (classpath_env != NULL) {
    strcat(classpath_str, classpath_env);
  }
	
  // set options for the JVM
  options[nJVMOptions++].optionString = "-Djava.compiler=NONE";
  options[nJVMOptions++].optionString = classpath_str;
	
  //set additional JVM options for Java debugging if necessary.
  if (javaDebugMode) {
    options[nJVMOptions++].optionString = "-Xdebug";
    options[nJVMOptions++].optionString = "-Xnoagent";
    options[nJVMOptions++].optionString = "-Xrunjdwp:transport=dt_shmem,address=pega,server=y,suspend=y";
  }

        
  // set arguments for the JVM
  vm_args.version = JNI_VERSION_1_2;
  vm_args.options = options;
  vm_args.nOptions = nJVMOptions;
  vm_args.ignoreUnrecognized = JNI_TRUE;
	
  // create the JVM
  jstat = JNI_CreateJavaVM(&jvm, (void**)(&env), &vm_args);
  // return codes from create are questionable
}

The original bug item recommends linking with the threads library before the
jvm library.  I have done so with my shared library that invokes JNI:

/dskaol01/s72_dev/pegdevbin/bin> ldd -i zis_gapi_java.so
        libsocket.so.1 =>        /usr/lib/libsocket.so.1
        libC.so.5 =>     /usr/lib/libC.so.5
        libw.so.1 =>     /usr/lib/libw.so.1
        libthread.so.1 =>        /usr/lib/libthread.so.1
        libc.so.1 =>     /usr/lib/libc.so.1
        libWfAAPI.so =>  /dskaol01/s72_dev/pegdevbin/bin/libWfAAPI.so
        libjvm.so =>     /usr/j2se/jre/lib/sparc/libjvm.so
        libzstdlib.so =>         /dskaol01/s72_dev/pegdevbin/bin/libzstdlib.so
        libztdlib.so =>  /dskaol01/s72_dev/pegdevbin/bin/libztdlib.so
        libznetlib.so =>         /dskaol01/s72_dev/pegdevbin/bin/libznetlib.so
        libzdblib.so =>  /dskaol01/s72_dev/pegdevbin/bin/libzdblib.so
        libzclipbrd.so =>        /dskaol01/s72_dev/pegdevbin/bin/libzclipbrd.so
        libzformlib.so =>        /dskaol01/s72_dev/pegdevbin/bin/libzformlib.so
        libzdispatch.so =>       /dskaol01/s72_dev/pegdevbin/bin/libzdispatch.so
        libztopapi.so =>         /dskaol01/s72_dev/pegdevbin/bin/libztopapi.so
        libzshelllib.so =>       /dskaol01/s72_dev/pegdevbin/bin/libzshelllib.so
        libnsl.so.1 =>   /usr/lib/libnsl.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1
        libm.so.1 =>     /opt/SUNWspro/lib/libm.so.1
        libCrun.so.1 =>  /usr/lib/libCrun.so.1
        libcurses.so.1 =>        /usr/lib/libcurses.so.1
        libm.so.1 (SUNW_1.1) =>  (version not found)
        libmp.so.2 =>    /usr/lib/libmp.so.2
        /usr/platform/SUNW,Ultra-Enterprise/lib/libc_psr.so.1
 
   init library=/usr/lib/libthread.so.1
   init library=/usr/lib/libc.so.1
   init library=/usr/lib/libmp.so.2
   init library=/usr/lib/libnsl.so.1
   init library=/usr/lib/libsocket.so.1
   init library=/usr/lib/libC.so.5
   init library=/usr/lib/libcurses.so.1
   init library=/dskaol01/s72_dev/pegdevbin/bin/libzstdlib.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libztdlib.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libznetlib.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libzdblib.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libzclipbrd.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libzformlib.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libzdispatch.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libztopapi.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libzshelllib.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libWfAAPI.so
   init library=/usr/lib/libCrun.so.1
   init library=/usr/j2se/jre/lib/sparc/libjvm.so
   init library=./zis_gapi_java.so

...as well as with my main program:
/dskaol01/s72_dev/pegdevbin/bin> ldd -i zcxpson
        libzstdlib.so =>         /dskaol01/s72_dev/pegdevbin/bin/libzstdlib.so
        libztdlib.so =>  /dskaol01/s72_dev/pegdevbin/bin/libztdlib.so
        libznetlib.so =>         /dskaol01/s72_dev/pegdevbin/bin/libznetlib.so
        libzdblib.so =>  /dskaol01/s72_dev/pegdevbin/bin/libzdblib.so
        libzclipbrd.so =>        /dskaol01/s72_dev/pegdevbin/bin/libzclipbrd.so
        libzformlib.so =>        /dskaol01/s72_dev/pegdevbin/bin/libzformlib.so
        libzdispatch.so =>       /dskaol01/s72_dev/pegdevbin/bin/libzdispatch.so
        libztopapi.so =>         /dskaol01/s72_dev/pegdevbin/bin/libztopapi.so
        libzshelllib.so =>       /dskaol01/s72_dev/pegdevbin/bin/libzshelllib.so
        libcurses.so.1 =>        /usr/lib/libcurses.so.1
        libthread.so.1 =>        /usr/lib/libthread.so.1
        libjvm.so =>     /usr/j2se/jre/lib/sparc/libjvm.so
        libsocket.so.1 =>        /usr/lib/libsocket.so.1
        libnsl.so.1 =>   /usr/lib/libnsl.so.1
        libC.so.5 =>     /usr/lib/libC.so.5
        libw.so.1 =>     /usr/lib/libw.so.1
        libc.so.1 =>     /usr/lib/libc.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1
        libm.so.1 =>     /opt/SUNWspro/lib/libm.so.1
        libm.so.1 (SUNW_1.1) =>  (version not found)
        libCrun.so.1 =>  /usr/lib/libCrun.so.1
        libmp.so.2 =>    /usr/lib/libmp.so.2
        /usr/platform/SUNW,Ultra-Enterprise/lib/libc_psr.so.1
 
   init library=/usr/lib/libthread.so.1
   init library=/usr/lib/libc.so.1
   init library=/usr/lib/libmp.so.2
   init library=/usr/lib/libnsl.so.1
   init library=/usr/lib/libcurses.so.1
   init library=/usr/lib/libsocket.so.1
   init library=/usr/lib/libC.so.5
   init library=/dskaol01/s72_dev/pegdevbin/bin/libzstdlib.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libztdlib.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libznetlib.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libzdblib.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libzclipbrd.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libzformlib.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libzdispatch.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libztopapi.so
   init library=/dskaol01/s72_dev/pegdevbin/bin/libzshelllib.so
   init library=/usr/lib/libCrun.so.1
   init library=/usr/j2se/jre/lib/sparc/libjvm.so
(Review ID: 117568) 
======================================================================

Comments
EVALUATION Gabe, In your JNI_CreateVM add the following option mentioned below. This is not a fix. This will determine if you are seeing the same problem many users are seeing with JNI on 1.2 and shift to 1.3. Does your app uses custom signal handlers? Add this VM OPTION -XX:+AllowUserSignalHandlers gary.collins@East 2001-02-28 From ###@###.### Wed Feb 28 17:33:43 2001 From: Gabe Ernst-Edwards <###@###.###> To: "'Gary Collins - SunSoft Engineering'" <###@###.###> Subject: RE: JNI_CreateJavaVM causes segmentation fault MIME-Version: 1.0 X-Status: $$$$ X-UID: 0000000598 Adding the option allows my code to work. I am using custom signal handlers. Thanks! Gabe Ernst-Edwards Principle Software Engineer, PegaCONNECT Pegasystems Inc. Closing as a duplicate of the signal chaining bug. Needs to be fixed in next release. gary.collins@East 2001-03-02
02-03-2001