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

SIGBUS error in class.getInterfaces() from applet

XMLWordPrintable

    • 1.0.2
    • sparc
    • solaris_2, solaris_2.5
    • Not verified

      On solaris a SIGBUS occurs during a call to class.getInterfaces in some circumstances.

      It occurs when a locally loaded class tries to get the interfaces from a class loaded
      by the AppletLoader. It does not occur when an applet loaded class calls getInterfaces()
      or a Applet loaded class calls getInterfaces before the local class.
      It seems related to delayed resolution of the interfaces.

      Here is a script that will extract the needed files, compile and run the appletviewer
      to demonstrate the problem. Copy and Paste the following down to EOFEOF to a shell
      then invoke the script as "sh setup".

      % cat >setup <<EOFEOF
      #!/bin/sh
      cat >Touch.java <<EOF
      public class Touch {
          public void interfaces(Class cl) {
      Class[] intf = cl.getInterfaces();
      for (int i = 0; i < intf.length; i++) {
      System.out.println(" - " + intf[i].getName());
      }
          }

      }
      EOF

      cat >TestApplet.java <<EOF
      /* Applet to exercise a bug that causes a SIGBUS error
       * when a locally loaded class tries to get the interface from an
       * AppletLoaded class.
       */

      public class TestApplet extends java.applet.Applet {

          public synchronized void init() {
      try {
      // Class sample is loaded using the applet loader
      Sample i = new Sample();

      // Class Touch is in CLASSPATH and is loaded locally
      Touch t = new Touch();

      // Invoke the locally loaded class to get the interfaces
      t.interfaces(i.getClass());

      System.out.println("Done.");
      } catch (Exception ex) {
      ex.printStackTrace();
      }
          }
      }

      interface EmptyInterface {}

      class Sample implements EmptyInterface {
      }
      EOF

      cat >test.html <<EOF
      <applet code="TestApplet" width=200 height=100>
      </applet>
      EOF

      javac *.java
      mkdir classes
      mv Touch.class classes
      CLASSPATH=./classes
      appletviewer test.html
      EOFEOF


      % sh setup

      SIGBUS 10* bus error
          si_signo [10]: SIGBUS 10* bus error
          si_errno [0]: Error 0
          si_code [1]: BUS_ADRERR [addr: 0x25]

      stackbase=EF431000, stackpointer=EF42FE08

      Full thread dump:
          "Screen Updater" (TID:0xee303318, sys_thread_t:0xef090de0) prio=4
      java.lang.Object.wait(Object.java)
      sun.awt.ScreenUpdater.nextEntry(ScreenUpdater.java:75)
      sun.awt.ScreenUpdater.run(ScreenUpdater.java:95)
          "AWT-Motif" (TID:0xee302fa8, sys_thread_t:0xef0c0de0) prio=5
      java.lang.Thread.run(Thread.java)
          "AWT-Input" (TID:0xee302f80, sys_thread_t:0xef0f0de0) prio=5
          "thread applet-TestApplet" (TID:0xee302db0, sys_thread_t:0xef430de0) prio=6: pending=java.lang.NoClassDefFoundError *current thread*
      Touch.interfaces(Touch.java:3)
      TestApplet.init(TestApplet.java:14)
      sun.applet.AppletPanel.run(AppletPanel.java:243)
      java.lang.Thread.run(Thread.java)
          "Finalizer thread" (TID:0xee300370, sys_thread_t:0xef460de0) prio=1
          "Async Garbage Collector" (TID:0xee300318, sys_thread_t:0xef490de0) prio=1
          "Idle thread" (TID:0xee3002a0, sys_thread_t:0xef4c0de0) prio=0
          "clock handler" (TID:0xee3001f8, sys_thread_t:0xef4f0de0) prio=11
          "main" (TID:0xee3000a0, sys_thread_t:0x7da50) prio=5
      Monitor Cache Dump:
          unknown key (key=0xef490de0): monitor owner: "Async Garbage Collector"
          sun.awt.motif.MToolkit@EE302F68/EE33ECB0 (key=0xee302f68): unowned
      Waiting to be notified:
      "AWT-Input"
          sun.awt.ScreenUpdater@EE303318/EE33F6C0 (key=0xee303318): unowned
      Waiting to be notified:
      "Screen Updater"
          TestApplet@EE303820/EE342A48 (key=0xee303820): monitor owner: "thread applet-TestApplet"
      Registered Monitor Dump:
          Finalize me queue lock: unowned
      Waiting to be notified:
      "Finalizer thread"
          Thread queue lock: unowned
      Waiting to be notified:
      "main"
          Class lock: unowned
          Java stack lock: unowned
          Code rewrite lock: unowned
          Heap lock: unowned
          Has finalization queue lock: unowned
          Monitor IO lock: unowned
          Child death monitor: unowned
          Event monitor: unowned
          I/O monitor: unowned
          Alarm monitor: unowned
      Waiting to be notified:
      "clock handler"
          Sbrk lock: unowned
          Monitor cache lock: unowned
          Monitor registry: monitor owner: "thread applet-TestApplet"
      Thread Alarm Q:
      Abort(coredump)



      A stack trace from dbx follows:

      (debugger) where
      =>[1] java_lang_Class_getInterfaces(0xee300838, 0xef430278, 0x7fb8c, 0x959d8, 0x81010100, 0x0), at 0x26b20
        [2] Java_java_lang_Class_getInterfaces_stub(0xfb2c0, 0xef430ccc, 0x12c, 0x959d8, 0xef430ccc, 0xee33e954), at 0x325b0
        [3] invokeNativeMethod(0xee300838, 0xa847c, 0x1, 0xef430ccc, 0x400, 0xee33e959), at 0x30594
        [4] invokeLazyNativeMethod(0xee300838, 0xa847c, 0x1, 0xef430ccc, 0x0, 0xee33e87f), at 0x30928
        [5] ExecuteJava(0xef430ba6, 0xef430ccc, 0xfb288, 0xfb2b0, 0xfb298, 0x14af49), at 0x53918
        [6] do_execute_java_method_vararg(0xef430ccc, 0xee302eb0, 0x98f8c, 0x98f90, 0x0, 0x0), at 0x42b8c
        [7] execute_java_dynamic_method(0x0, 0xee302eb0, 0x98f8c, 0x98f90, 0xefffde74, 0x0), at 0x4186c
        [8] ThreadRT0(0xee302eb0, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x61fcc
        [9] start_func(0x1, 0xee302eb0, 0x61ea0, 0x0, 0x0, 0x0), at 0x79f58
      (debugger)

      The description field as copied from bug report 1260371 follows:

      Calling the Class.getInterfaces() method causes the VM to core dump if the interface
      class file is missing. The following is an example. If you compile Sample.java and
      remove EmptyInterface.class and run Sample the VM gets a bus error.



      zaphod: sigbus, 134 > cat Sample.java
      class Sample implements EmptyInterface {
          public static void main(String[] args)
          {
      Sample sample = new Sample();
      System.out.println(sample.getClass().getInterfaces());
          }
      }
      zaphod: sigbus, 135 > cat EmptyInterface.java
      interface EmptyInterface {}
      zaphod: sigbus, 136 > javac Sample.java
      zaphod: sigbus, 137 > rm EmptyInterface.class
      rm: remove EmptyInterface.class (y/n)? y
      zaphod: sigbus, 138 > java Sample
      SIGBUS 10* bus error
          si_signo [10]: SIGBUS 10* bus error
          si_errno [0]: Error 0
          si_code [1]: BUS_ADRERR [addr: 0x35]

      stackbase=EFFFF77C, stackpointer=EFFFF440

      Full thread dump:
          "Finalizer thread" (TID:0xee7003a0, sys_thread_t:0xee3f1de0) prio=1
          "Async Garbage Collector" (TID:0xee700358, sys_thread_t:0xef441de0) prio=1
          "Idle thread" (TID:0xee700310, sys_thread_t:0xef471de0) prio=0
          "clock handler" (TID:0xee7000d0, sys_thread_t:0xef551de0) prio=11
          "main" (TID:0xee7000a0, sys_thread_t:0x82690) prio=5: pending=java.lang.NoClassDefFoundError *current thread*
      Sample.main(Sample.java:5)
      Monitor Cache Dump:
      Registered Monitor Dump:
          Finalize me queue lock: unowned
          Thread queue lock: unowned
          Class lock: unowned
          String intern lock: unowned
          Java stack lock: unowned
          Code rewrite lock: unowned
          Heap lock: unowned
          Has finalization queue lock: unowned
          Monitor IO lock: unowned
          Child death monitor: unowned
          Event monitor: unowned
          I/O monitor: unowned
          Alarm monitor: unowned
      Waiting to be notified:
      "clock handler"
          Sbrk lock: unowned
          Monitor cache lock: unowned
          Monitor registry: monitor owner: "main"
      Thread Alarm Q:
      Abort (core dumped)
      zaphod: sigbus, 139 >

            tlindholsunw Timothy Lindholm (Inactive)
            rriggs Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: