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

JNI app dies with "Internal Error" in JNI_CreateVM

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P2
    • None
    • 1.3.0
    • hotspot
    • sparc
    • solaris_2.6

    Description



      Name: yyT116575 Date: 02/02/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-RC)
      Java HotSpot(TM) Client VM (build 1.3.0-RC, mixed mode)


      I get the following error when I try to create a JVM using JNI
      from inside a large multi-threaded application.

        Calling createJVM...
        #
        # HotSpot Virtual Machine Error, Internal Error
        # Please report this error at
        # http://java.sun.com/cgi-bin/bugreport.cgi
        #
        ###### ERROR: Abnormal shutdown of process 11574 thread 9.

      I am running JDK1.3 on a Sun Ultra 10 running Solaris 2.6. I tried
      both the client and server JVM libraries with the same result.

      Note : This same application worked fine using JDK1.2

      Here is the stack trace for the offending thread :

        lwp#10 ----------
         ee1b92cc waitid (0, 2d4a, ed8ff258, 3)
         ee1d4644 _libc_waitpid (2d4a, ed8ff3cc, 0, 0, ef1b7e20, ef1bb368) + 54
         ef1a601c _ti_waitpid (b, ed8ffd20, ed8ffa68, ef1b6c40, ed901e48, ed901e28) + 34
         ef1a4758 __libthread_segvhdlr (b, ed8ffd20, ed8ffa68, ef1b6c40, 0, 0) + e0
         ef1a668c __sighndlr (b, ed8ffd20, ed8ffa68, ef1a4678, ed901e48, ed901e28) + c
         ef1a3b14 sigacthandler (b, ed8ffd20, ed8ffa68, ef1b6c40, 2c, ed901e58) + 71c
         ece39ff8 __1cSThreadLocalStorageUget_thread_via_cache6F_pnGThread__
      (ed019e6c, ed0306cc, 138, ed8ff, ed019e6c, ed8ffe04) + 24
         eccc43b4 __1cMreport_error6Flpkci11E_v_ (e4, ed900684, 751, ecfbfc38,
      ed077414, ed019e6c) + 2c4
         eccc3e40 __1cMreport_fatal6Fpkci1E_v_ (751, ed019e6c, ecfd1270, 16c050, b,
      3e4398) + 60
         ecdd37e0 __1cJos_init_26F_l_ (1, ed077414, ed0303a0, ed019e6c, ed019e6c, 0) + 1d8
         ece37478 __1cHThreadsJcreate_vm6FpnOJavaVMInitArgs__l_ (ed901990, ed027514,
      0, ed019e6c, ecfdb7c4, 0) + 78
         ecd4baa0 JNI_CreateJavaVM (ed027514, ffffffff, ed901990, ed019e6c, ed9019e0,
      ed9019dc) + 48
         0008c258 __0fFMyJVMKThreadMainiT (0, 47ad48, 0, 0, 0, 0) + 3c0
         001a3814 __0fJUCSThreadKThreadMainPvT (47ad48, 0, 1, ef1b8390, 1, ef1b6c40) + c44
         ef1a6590 _thread_start (47ad48, 0, 0, 0, 0, 0) + 40

      Here is the code for the thread that creates the JVM.

      void MyJVM::ThreadMain( int )
      {
        JNIEnv* env;
        JavaVM* jvm;

        //------------------------------------------------------------
        // Load the JVM shared library specified on the command-line
        //------------------------------------------------------------
        void *libVM = dlopen( JVMArg.Get(), RTLD_LAZY );
        if ( libVM == NULL )
        {
          cerr << "Error loading JVM " << JVMArg.Get() << endl;
          cerr << dlerror() << endl;
          return;
        }

        //------------------------------------------------------------
        // Locate the function used to create a new JVM
        //------------------------------------------------------------
        CreateJavaVMFunc* createJVM =
            (CreateJavaVMFunc*)dlsym( libVM, "JNI_CreateJavaVM" );
        if ( createJVM == NULL )
        {
          cerr << "Can't find symbol JNI_CreateJavaVM in " << JVMArg.Get() << endl;
          return;
        }

        //--------------------------------------------------
        // Create the Java Virtual machine
        //--------------------------------------------------
        JavaVMOption options[1];
        options[0].optionString = "-Djava.class.path=" USER_CLASSPATH;

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

        cerr << "Calling createJVM..." << endl;
        jint res = createJVM( &jvm, (void**)&env, &vm_args );
        cerr << "done." << endl;
      (Review ID: 116303)
      ======================================================================






      02/15

      i2 is experiencing a similar problem using JDK1.3 on Solaris 2.6

      #
      >> # HotSpot Virtual Machine Error, Internal Error
      >> # Please report this error at
      >> # http://java.sun.com/cgi-bin/bugreport.cgi
      >> #
      >> [error occured during error reporting]
      >> Segmentation fault


      (dbx) where
      >> current thread: t@1
      >> [1] ThreadLocalStorage::get_thread_via_cache(0xef173b44, 0xef1897c4, 0x4,
      >> 0xefffd, 0xef173b44, 0xefffd41c), at 0xef05706c
      >> [2] report_error(0xe4, 0xefffdc9c, 0x751, 0xef13062c, 0xef1aadbc,
      >> 0xef173b44), at 0xeeee4c1c
      >> [3] report_fatal(0x751, 0xef173b44, 0xef141b2c, 0xef225b88, 0x8,
      >> 0x522f450), at 0xeeee46a8
      >> [4] os_init_2(0x1, 0xef1aadbc, 0xef1894c8, 0xef173b44, 0xef173b44, 0x0),
      >> at 0xeeff0f48
      >> [5] Threads::create_vm(0xefffefec, 0xef180644, 0x0, 0xef173b44,
      >> 0xef14bd9c, 0x0), at 0xef0545e8
      >> [6] JNI_CreateJavaVM(0xef180644, 0xffffffff, 0xefffefec, 0xef173b44,
      >> 0x51f50b8, 0x522f160), at 0xeef69640
      >> =>[7] Java_Interface::initialize(), line 473 in
      >> "/view/yuriy_new/dvobs/share/model_pkg/ws/java_interface.c"
      >> [8] sinit257_init_func(), line 265 in
      >> "/view/yuriy_new/dvobs/share/model_pkg/ws/java_interface.c"
      >> [9] After_Static_Initializers::call(max = 3.0), line 104 in
      >> "/view/yuriy_new/dvobs/share/bbc_pkg/base/initialize.c"
      >> [10] set_options(argc = 4, argv = 0xeffff2dc, option_file_path = (nil)),
      >> line 622 in "/view/yuriy_new/dvobs/share/bbc_pkg/base/option_base.c"
      >> [11] main(argc = 4, argv = 0xeffff2dc), line 702 in "rl_engine.c"


      Here's a snippet of their code:

       JavaVMInitArgs vm_args;
          int numOptions = 0;
          JavaVMOption jvmOptions[20];
          char *buff;

          vm_args.version = JNI_VERSION_1_2;
          vm_args.ignoreUnrecognized = TRUE;

          char const* clspath = getenv("CLASSPATH");
          if (clspath) {
            buff = new char[20 + strlen(clspath)];
            strcpy(buff, "-Djava.class.path=");
            strcat(buff, clspath);
            jvmOptions[numOptions].optionString = buff;
            numOptions++;
          }

      #if 0
          char** properties = java_properties.props();
          if (properties)
          {
            for (int i = 0; properties[i] != NULL; i++)
            {
      Str buffer(S("-D"));
      buffer += properties[i];
      jvmOptions[numOptions].optionString =
      REINTERPRET_CAST(char*)(str_copy_new(buffer()));
      numOptions++;
            }
          }
      #endif

          vm_args.nOptions = numOptions;
          vm_args.options = (JavaVMOption *) jvmOptions;

          jint res = JNI_CreateJavaVM(&jvm_, (void **) &env_, &vm_args);
          if (res != 0 && // Failure
              res != -1234) // and JNI_CreateJavaVM isn't stubbed (see
      model_pkg/java_stubs.c)
            error("Can't create a Java Virtual Machine\n"
                  "\tDoes the CLASSPATH environment variable include\n"
                  "\tthe Java language .zip or .jar file?\n"
                  "The current CLASSPATH is:\n"
                  "\t{0}", Java_Interface::class_path());

          if (res < 0)
            return false;

          if (jvm_ == 0) {
            error("Can't create Java VM");
            return false;
          }


      Attachments

        Issue Links

          Activity

            People

              kbr Kenneth Russell (Inactive)
              yyoungsunw Yung-ching Young (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: