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

Segmentation fault introspecting ((Throwable) obj).backtrace[0][0]

XMLWordPrintable

    • hopper
    • x86, sparc
    • linux, solaris_7



      Name: rmT116609 Date: 08/24/2001


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


      In constructing a generic object introspection tool for debugging purposes, we
      found that retrieving the class name for the object at throwable.backtrace[0][0]
      consistently segfaults (where throwable is an instance of java.lang.Throwable).
      (see comments)

      A minimal test case:

      import java.lang.reflect.*;

      class ThrowableIntrospectionSegfault {
          static public void main( String[] argv)
          {
              // Construct a throwable object.
              Throwable throwable = new Throwable();
              throwable.fillInStackTrace();
              
              // Retrieve a reflection handle to the private backtrace field.
              Class class1 = throwable.getClass();
              Field field;
              try {
                  field = class1.getDeclaredField("backtrace");
              }
              catch (NoSuchFieldException e) {
                  System.err.println("Can't retrieve field handle Throwable.backtrace: " + e.toString());
                  return;
              }
              field.setAccessible(true);

              // Retrieve the value of the backtrace field.
              Object backtrace;
              try {
                  backtrace = field.get(throwable);
              }
              catch (IllegalAccessException e) {
                  System.err.println( "Can't retrieve field value for Throwable.backtrace: " + e.toString());
                  return;
              }

              // Retrieve the class of throwable.backtrace[0][0].
              Class class2 = ((Object[]) ((Object[]) backtrace)[0])[0].getClass();
              
              // Segfault occurs while executing this line, to retrieve the name of
              // this class.
              String class2Name = class2.getName();
              
              System.err.println("class2Name=" + class2Name);
          }
      }


      The behavior I would expect for this test program would be anything aside
      from a segmentation fault. :) In the ideal case, this program would reach
      this line:

          System.err.println("class2Name=" + class2Name);

      And print

          class2Name=<some value>


      If the alternative is a segmentation fault, it would have been confusing,
      but tolerable, for this line to raise an IllegalAccessException:

          backtrace = field.get(throwable);



      With JDK1.3.1:
      -----------
      Unexpected Signal : 11 occurred at PC=0x4020e5e1
      Function name=as_C_string__C13symbolOopDesc
      Library=/usr/java/jdk1.3.1/jre/lib/i386/client/libjvm.so

      Current Java thread:
              at java.lang.Class.getName(Native Method)
              at ThrowableIntrospectionSegfault.main(ThrowableIntrospectionSegfault.java:37)

      Dynamic libraries:
      08048000-0804c000 r-xp 00000000 03:06 1240713 /usr/java/jdk1.3.1/bin/i386/native_threads/java
      0804c000-0804d000 rw-p 00003000 03:06 1240713 /usr/java/jdk1.3.1/bin/i386/native_threads/java
      40000000-40016000 r-xp 00000000 03:06 244823 /lib/ld-2.2.2.so
      40016000-40017000 rw-p 00015000 03:06 244823 /lib/ld-2.2.2.so
      40018000-40019000 r--p 00000000 03:06 1762565 /usr/lib/locale/en_US/LC_IDENTIFICATION
      40019000-4001a000 r--p 00000000 03:06 1762566 /usr/lib/locale/en_US/LC_MEASUREMENT
      4001a000-4001b000 r--p 00000000 03:06 1762569 /usr/lib/locale/en_US/LC_TELEPHONE
      4001b000-4001c000 r--p 00000000 03:06 1762564 /usr/lib/locale/en_US/LC_ADDRESS
      4001c000-4001d000 r--p 00000000 03:06 1762567 /usr/lib/locale/en_US/LC_NAME
      4001d000-4001e000 r--p 00000000 03:06 1762568 /usr/lib/locale/en_US/LC_PAPER
      4001e000-4001f000 r--p 00000000 03:06 1632012 /usr/lib/locale/en_US/LC_MESSAGES/SYS_LC_MESSAGES
      4001f000-40020000 r--p 00000000 03:06 864968 /usr/lib/locale/en_US/LC_MONETARY
      40020000-40026000 r--p 00000000 03:06 571211 /usr/lib/locale/en_US/LC_COLLATE
      40026000-40027000 r--p 00000000 03:06 1762570 /usr/lib/locale/en_US/LC_TIME
      40027000-40034000 r-xp 00000000 03:06 1729951 /lib/i686/libpthread-0.9.so
      40034000-4003c000 rw-p 0000c000 03:06 1729951 /lib/i686/libpthread-0.9.so
      4003c000-40045000 r-xp 00000000 03:06 946930 /usr/java/jdk1.3.1/jre/lib/i386/native_threads/libhpi.so
      40045000-40046000 rw-p 00008000 03:06 946930 /usr/java/jdk1.3.1/jre/lib/i386/native_threads/libhpi.so
      40046000-402ad000 r-xp 00000000 03:06 555551 /usr/java/jdk1.3.1/jre/lib/i386/client/libjvm.so
      402ad000-40413000 rw-p 00266000 03:06 555551 /usr/java/jdk1.3.1/jre/lib/i386/client/libjvm.so
      4042a000-4042d000 r-xp 00000000 03:06 244836 /lib/libdl-2.2.2.so
      4042d000-4042e000 rw-p 00002000 03:06 244836 /lib/libdl-2.2.2.so
      4042e000-40554000 r-xp 00000000 03:06 1729947 /lib/i686/libc-2.2.2.so
      40554000-4055a000 rw-p 00125000 03:06 1729947 /lib/i686/libc-2.2.2.so
      4055e000-40571000 r-xp 00000000 03:06 244841 /lib/libnsl-2.2.2.so
      40571000-40573000 rw-p 00012000 03:06 244841 /lib/libnsl-2.2.2.so
      40575000-40598000 r-xp 00000000 03:06 1729949 /lib/i686/libm-2.2.2.so
      40598000-40599000 rw-p 00022000 03:06 1729949 /lib/i686/libm-2.2.2.so
      4059a000-405ce000 r-xp 00000000 03:06 636514 /usr/lib/libstdc++-2-libc6.1-1-2.9.0.so
      405ce000-405da000 rw-p 00033000 03:06 636514 /usr/lib/libstdc++-2-libc6.1-1-2.9.0.so
      405dc000-405ed000 r-xp 00000000 03:06 1518265 /usr/java/jdk1.3.1/jre/lib/i386/libverify.so
      405ed000-405ef000 rw-p 00010000 03:06 1518265 /usr/java/jdk1.3.1/jre/lib/i386/libverify.so
      405ef000-40610000 r-xp 00000000 03:06 1518256 /usr/java/jdk1.3.1/jre/lib/i386/libjava.so
      40610000-40612000 rw-p 00020000 03:06 1518256 /usr/java/jdk1.3.1/jre/lib/i386/libjava.so
      40613000-40627000 r-xp 00000000 03:06 1518266 /usr/java/jdk1.3.1/jre/lib/i386/libzip.so
      40627000-4062a000 rw-p 00013000 03:06 1518266 /usr/java/jdk1.3.1/jre/lib/i386/libzip.so
      4062a000-41343000 r--s 00000000 03:06 506689 /usr/java/jdk1.3.1/jre/lib/rt.jar
      41370000-41615000 r--s 00000000 03:06 506682 /usr/java/jdk1.3.1/jre/lib/i18n.jar
      41615000-4162b000 r--s 00000000 03:06 506690 /usr/java/jdk1.3.1/jre/lib/sunrsasign.jar
      436d3000-436d4000 r--p 00000000 03:06 342731 /usr/lib/locale/en_US/LC_NUMERIC
      436d4000-436de000 r-xp 00000000 03:06 244857 /lib/libnss_files-2.2.2.so
      436de000-436df000 rw-p 00009000 03:06 244857 /lib/libnss_files-2.2.2.so
      49d3f000-49d5a000 r--p 00000000 03:06 1680972 /usr/lib/locale/en_US/LC_CTYPE

      Local Time = Fri Aug 24 11:36:48 2001
      Elapsed Time = 0
      #
      # HotSpot Virtual Machine Error : 11
      # Error ID : 4F530E43505002CC
      # Please report this error at
      # http://java.sun.com/cgi-bin/bugreport.cgi
      #
      # Java VM: Java HotSpot(TM) Client VM (1.3.1-b24 mixed mode)
      #
      # An error report file has been saved as hs_err_pid13573.log.
      # Please refer to the file for further information.
      #



      With JDK1.4.0-beta:
      ----------------

      Unexpected Signal : 11 occurred at PC=0x40256C61
      Function=as_C_string__C13symbolOopDesc+0x15
      Library=/usr/java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so

      Current Java thread:
              at java.lang.Class.getName(Native Method)
              at ThrowableIntrospectionSegfault.main(ThrowableIntrospectionSegfault.java:37)

      Dynamic libraries:
      08048000-08051000 r-xp 00000000 03:06 538914 /usr/java/j2sdk1.4.0/bin/i386/native_threads/java
      08051000-08053000 rw-p 00008000 03:06 538914 /usr/java/j2sdk1.4.0/bin/i386/native_threads/java
      40000000-40016000 r-xp 00000000 03:06 244823 /lib/ld-2.2.2.so
      40016000-40017000 rw-p 00015000 03:06 244823 /lib/ld-2.2.2.so
      40018000-40021000 r-xp 00000000 03:06 293938 /usr/java/j2sdk1.4.0/jre/lib/i386/native_threads/libhpi.so
      40021000-40022000 rw-p 00008000 03:06 293938 /usr/java/j2sdk1.4.0/jre/lib/i386/native_threads/libhpi.so
      40022000-40023000 r--p 00000000 03:06 1762565 /usr/lib/locale/en_US/LC_IDENTIFICATION
      40023000-40024000 r--p 00000000 03:06 1762566 /usr/lib/locale/en_US/LC_MEASUREMENT
      40024000-40025000 r--p 00000000 03:06 1762569 /usr/lib/locale/en_US/LC_TELEPHONE
      40025000-40026000 r--p 00000000 03:06 1762564 /usr/lib/locale/en_US/LC_ADDRESS
      40026000-40027000 r--p 00000000 03:06 1762567 /usr/lib/locale/en_US/LC_NAME
      40027000-40034000 r-xp 00000000 03:06 1729951 /lib/i686/libpthread-0.9.so
      40034000-4003c000 rw-p 0000c000 03:06 1729951 /lib/i686/libpthread-0.9.so
      4003c000-40338000 r-xp 00000000 03:06 1991764 /usr/java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
      40338000-40508000 rw-p 002fb000 03:06 1991764 /usr/java/j2sdk1.4.0/jre/lib/i386/client/libjvm.so
      4051c000-4051f000 r-xp 00000000 03:06 244836 /lib/libdl-2.2.2.so
      4051f000-40520000 rw-p 00002000 03:06 244836 /lib/libdl-2.2.2.so
      40520000-40646000 r-xp 00000000 03:06 1729947 /lib/i686/libc-2.2.2.so
      40646000-4064c000 rw-p 00125000 03:06 1729947 /lib/i686/libc-2.2.2.so
      40650000-40663000 r-xp 00000000 03:06 244841 /lib/libnsl-2.2.2.so
      40663000-40665000 rw-p 00012000 03:06 244841 /lib/libnsl-2.2.2.so
      40667000-4069b000 r-xp 00000000 03:06 636514 /usr/lib/libstdc++-2-libc6.1-1-2.9.0.so
      4069b000-406a7000 rw-p 00033000 03:06 636514 /usr/lib/libstdc++-2-libc6.1-1-2.9.0.so
      406a9000-406cc000 r-xp 00000000 03:06 1729949 /lib/i686/libm-2.2.2.so
      406cc000-406cd000 rw-p 00022000 03:06 1729949 /lib/i686/libm-2.2.2.so
      406ce000-406e3000 r-xp 00000000 03:06 1975470 /usr/java/j2sdk1.4.0/jre/lib/i386/libverify.so
      406e3000-406e6000 rw-p 00014000 03:06 1975470 /usr/java/j2sdk1.4.0/jre/lib/i386/libverify.so
      406e6000-4070c000 r-xp 00000000 03:06 1975460 /usr/java/j2sdk1.4.0/jre/lib/i386/libjava.so
      4070c000-4070f000 rw-p 00025000 03:06 1975460 /usr/java/j2sdk1.4.0/jre/lib/i386/libjava.so
      40710000-40724000 r-xp 00000000 03:06 1975471 /usr/java/j2sdk1.4.0/jre/lib/i386/libzip.so
      40724000-40727000 rw-p 00013000 03:06 1975471 /usr/java/j2sdk1.4.0/jre/lib/i386/libzip.so
      40727000-41bad000 r--s 00000000 03:06 1110421 /usr/java/j2sdk1.4.0/jre/lib/rt.jar
      41bec000-41edf000 r--s 00000000 03:06 1110411 /usr/java/j2sdk1.4.0/jre/lib/i18n.jar
      41edf000-41ef4000 r--s 00000000 03:06 1110422 /usr/java/j2sdk1.4.0/jre/lib/sunrsasign.jar
      41ef4000-41f6e000 r--s 00000000 03:06 1110414 /usr/java/j2sdk1.4.0/jre/lib/jsse.jar
      41f6e000-41f80000 r--s 00000000 03:06 1110413 /usr/java/j2sdk1.4.0/jre/lib/jce.jar
      44028000-44029000 r--p 00000000 03:06 1762568 /usr/lib/locale/en_US/LC_PAPER
      44029000-4402a000 r--p 00000000 03:06 1632012 /usr/lib/locale/en_US/LC_MESSAGES/SYS_LC_MESSAGES
      4402a000-4402b000 r--p 00000000 03:06 864968 /usr/lib/locale/en_US/LC_MONETARY
      4402b000-4402c000 r--p 00000000 03:06 1762570 /usr/lib/locale/en_US/LC_TIME
      4402c000-4402d000 r--p 00000000 03:06 342731 /usr/lib/locale/en_US/LC_NUMERIC
      4402d000-4402f000 r--s 00000000 03:06 1828068 /usr/java/j2sdk1.4.0/jre/lib/ext/dnsns.jar
      4a690000-4a6ab000 r--p 00000000 03:06 1680972 /usr/lib/locale/en_US/LC_CTYPE
      4a6ab000-4a6b1000 r--p 00000000 03:06 571211 /usr/lib/locale/en_US/LC_COLLATE
      4a6b1000-4a6be000 r--s 00000000 03:06 1828069 /usr/java/j2sdk1.4.0/jre/lib/ext/ldapsec.jar
      4a6c0000-4a6ca000 r-xp 00000000 03:06 244857 /lib/libnss_files-2.2.2.so
      4a6ca000-4a6cb000 rw-p 00009000 03:06 244857 /lib/libnss_files-2.2.2.so
      4aef6000-4af14000 r--s 00000000 03:06 1828070 /usr/java/j2sdk1.4.0/jre/lib/ext/sunjce_provider.jar

      Local Time = Fri Aug 24 11:39:05 2001
      Elapsed Time = 0
      #
      # HotSpot Virtual Machine Error : 11
      # Error ID : 4F530E43505002D7
      # Please report this error at
      # http://java.sun.com/cgi-bin/bugreport.cgi
      #
      # Java VM: Java HotSpot(TM) Client VM (1.4.0-beta-b65 mixed mode)
      #
      # An error report file has been saved as hs_err_pid13664.log.
      # Please refer to the file for further information.
      #
      (Review ID: 129722)
      ======================================================================

            hhuangsunw Hui Huang (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: