Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4361067

hotspot VM crashes when bringing up thru JNI when signal handler is installed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P4
    • None
    • 2.0
    • hotspot
    • x86
    • linux

    Description



      Name: stC104175 Date: 08/09/2000


      $ java -version
      java version "1.3.0beta_refresh"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta_refresh-b09)
      Java HotSpot(TM) Client VM (build 1.3.0beta-b07, mixed mode)


      run the following code:
      #include <stdio.h>
      #include <signal.h>
      #include <assert.h>
      #include <jni.h>

      void signalHandler(int sig, siginfo_t* info, void *vp) { }

      int main(int argc, char **argv)
      {
        JNIEnv *env = NULL;
        JavaVM *JVP_jvm;
        jint res;
        JavaVMInitArgs vm_args;
        JavaVMOption options[1];
        struct sigaction sigAct;
        int ret;

        /* install a signal handler for SEGV */
        sigfillset(&(sigAct.sa_mask));
        sigAct.sa_handler = SIG_DFL;
        sigAct.sa_sigaction = signalHandler;
        sigAct.sa_flags = SA_SIGINFO|SA_RESTART;
        ret = sigaction(SIGSEGV,&sigAct,NULL);
        assert(ret == 0);

        options[0].optionString = "" ;
        // this resolves the problem, but does not install JVM's signal handlers:
        // options[0].optionString = "-XX:+AllowUserSignalHandlers" ;

        vm_args.version = JNI_VERSION_1_2 ;
        vm_args.options = options;
        vm_args.nOptions = 1;
        vm_args.ignoreUnrecognized = 1;

        res = JNI_CreateJavaVM(&JVP_jvm, (void **) &env, &vm_args);
        printf("JVM %screated.\n", res < 0 ? "not ":"" );

        return(0);
      }

      compiled with:
      cc -I/usr/java/include -I/usr/java/include/linux hotsig.c
      -L/usr/java/jre/lib/i386 -ljava

      $ ldd a.out
              libjava.so => /usr/java/jre/lib/i386/libjava.so (0x4001e000)
              libc.so.6 => /lib/libc.so.6 (0x40042000)
              libjvm.so => /usr/java/jre/lib/i386/hotspot/libjvm.so (0x4013d000)
              libverify.so => /usr/java/jre/lib/i386/libverify.so (0x40541000)
              libnsl.so.1 => /lib/libnsl.so.1 (0x40555000)
              libdl.so.2 => /lib/libdl.so.2 (0x4056b000)
              /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
              libpthread.so.0 => /lib/libpthread.so.0 (0x4056e000)
              libstdc++-libc6.1-1.so.2 => /usr/lib/libstdc++-libc6.1-1.so.2
      (0x40580000)
              libm.so.6 => /lib/libm.so.6 (0x405c8000)


      gives:
      $ a.out
      #
      # HotSpot Virtual Machine Error, Internal Error
      # Please report this error at
      # http://java.sun.com/cgi-bin/bugreport.cgi
      #
      # Error ID: 4F533F4C494E55580E4350500549
      #
      # Problematic Thread: Segmentation fault


      Is there a way to let the hotspot JVM install its own signal handlers
      if there are already signal handlers installed before VM is brought up
      thru JNI ?
      (Review ID: 107898)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              duke J. Duke
              stompkinsunw Sean Tompkins (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: