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

1.2c vm jni seg fault with JCK vm/jni/ExceptionOccurred/exoc001/exoc00101

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P2 P2
    • None
    • 1.2.0
    • hotspot
    • sparc
    • solaris_2.5.1

      (see Dmitry Khukro analysis below for more isolated case)
      JCK test segmentation violation on solaris, also fails on win32

      Test: vm/jni/ExceptionOccurred/exoc001/exoc00101/exoc00101.html
            exoc00101 - Determines if an exception is being thrown

      To regress, see /usr/sqe/sqe_TestExec/jtpfiles/regress{bugNumber} for scripts to run solaris JCK.

      Solaris result:
      Failed. unexpected exit code
      Solaris result file for c2zephyr112a = JCK112a, JDK1.2c, solaris native

      SIGSEGV 11* segmentation violation
          si_signo [11]: SIGSEGV 11* segmentation violation
          si_errno [0]: Error 0
          si_code [1]: SEGV_ACCERR [addr: 0x0]
       stackbase=F0000000, stackpointer=EFFFEFFC
      Full thread dump:
          "Finalizer" (TID:0xedb005e0, sys_thread_t:0x5a994, state:CW,
      thread_t: t-6, sp:0x0, stack_bottom:0xeeb44000, stack_size:0x22000)
      prio=1
       at java.lang.Object.wait(Native Method)
       at java.lang.Ref$Queue.remove(Ref.java:98)
       at java.lang.Ref$Queue.remove(Ref.java:105)
       at java.lang.Finalizer$FinalizerThread.run(Finalizer.java:136)
          "Ref handler" (TID:0xedb003b8, sys_thread_t:0x442ec, state:CW,
      thread_t: t-5, sp:0x0, stack_bottom:0xeeb74000, stack_size:0x22000)
      prio=10
       at java.lang.Object.wait(Native Method)
       at java.lang.Object.wait(Object.java:315)
       at java.lang.Ref$RefHandler.run(Ref.java:129)
          "SIGQUIT handler" (TID:0xedb002d8, sys_thread_t:0x9e2b4, state:R,
      thread_t: t-4, sp:0x0, stack_bottom:0xeeba4000, stack_size:0x22000)
      prio=0
          "main" (TID:0xedb00028, sys_thread_t:0x21404, state:R, thread_t:
      t-1, sp:0x0, stack_bottom:0xf0000000, stack_size:0x800000) prio=5:
      pending=java.lang.Exception *current thread*
       at javasoft.sqe.tests.vm.exoc001.exoc00101.exoc00101.exoc00101(Native
      Method)
       at
      javasoft.sqe.tests.vm.exoc001.exoc00101.exoc00101.check(exoc00101.java:51)

       at
      javasoft.sqe.tests.vm.exoc001.exoc00101.exoc00101.run(exoc00101.java:77)

       at
      javasoft.sqe.tests.vm.exoc001.exoc00101.exoc00101.main(exoc00101.java:21)

      Monitor Cache Dump:
          java.lang.Object-EDB003C0/EDB55FC8: <unowned>
       Waiting to be notified:
           "Ref handler"
          java.lang.Object-EDB00318/EDB564D0: <unowned>
       Waiting to be notified:
           "Finalizer"
      Registered Monitor Dump:
          JNI pinning lock: <unowned>
          JNI global reference lock: <unowned>
          BinClass lock: <unowned>
          Class loading lock: <unowned>
          Code rewrite lock: <unowned>
          Heap lock: <unowned>
          Monitor cache expansion lock: <unowned>
          Thread queue lock: <unowned>
          Monitor registry: owner "main" (0x21404, 1 entry)
      test result: Failed. unexpected exit code
      ----------------------------------------------------------------
      Per analysis/isolation of Dmitry Khukro:
      "Throw" call breaks result of next "GetMethodID" call:

      --exoc.java---------------------------------------------

      package javasoft.sqe.tests.vm.exoc001.exoc00101;
      import java.io.PrintStream;

      public class exoc00101 {

        public static void main(String argv[])
        {
          exoc00101 tob = new exoc00101();
          Exception ex = new Exception();
          try {
            tob.exoc00101(ex, ex.getClass());
          } catch (Throwable e) {
          }
        }

        public native boolean exoc00101(Throwable ex, Class cl);

        static {
          try {
            System.loadLibrary("exoc");
          } catch ( UnsatisfiedLinkError e ) {
            System.loadLibrary("jckjni");
          }
        }
      }

      --exoc.c---------------------------------------------

      #include <stdio.h>
      #include <stdlib.h>
      #include <string.h>
      #include "jckjni.h"

      JNIEXPORT jboolean JNICALL Java_javasoft_sqe_tests_vm_exoc001_exoc00101_exoc00101_exoc00101
      (JNIEnv *env, jobject obj, jthrowable excep, jclass cl)
       {
      jmethodID mID;

      printf("before Throw:\n");
      mID = (*env) -> GetMethodID(env,cl, "equals", "(Ljava/lang/Object;)Z");
      if (mID == NULL) {printf(" mID == NULL\n");} else printf(" mID != NULL\n");

      (*env) -> Throw(env,excep);

      printf("after Throw:\n");
      mID = (*env) -> GetMethodID(env,cl, "equals", "(Ljava/lang/Object;)Z");
      if (mID == NULL) {printf(" mID == NULL\n");} else printf(" mID != NULL\n");

      /* (*env) -> CallBooleanMethod(env,excep,mID,excep); */
      return JNI_FALSE;
       }
      -----------------------------------------------------------------
      Test outputs:

      before Throw:
        mID != NULL
      after Throw:
        mID == NULL

      Call "CallBooleanMethod" with mID == NULL crashes VM:

      segmentation violation

      (Dmitry's analysis installed by weston.isberg@Eng 1997-07-17 )

            sliangsunw Sheng Liang (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: