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

Cricket Regression: Showing PopupMenus can segfault on Solaris

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.2.2
    • 1.2.1
    • client-libs
    • None
    • 1.2.2
    • sparc
    • solaris_7

      Run the following test case. Repeatedly show the PopupMenu on the Label and
      the Button by right clicking on each of them. Java will crash after a few
      clicks. I am only seeing the crash when the JIT is turned on, so this may be
      a JIT bug. The crash occurs with both native and green threads.

      The test case runs fine on 1.2fcs.


      import java.awt.*;
      import java.awt.event.*;
      import java.lang.*;
      import java.util.Hashtable;

      public class action4
          extends Frame
          implements ActionListener, MouseListener {

        PopupMenu pm = new PopupMenu();

        public static void main (String argv[]) {
          new action4();
        }

        public action4() {
          MenuItem item = new MenuItem("file-1");
          item.addActionListener(this);
          Menu m = new Menu("file");
          m.add(item);
          item = new MenuItem("file-2");
          m.add(item);
          MenuBar mb = new MenuBar();
          mb.add(m);

          setMenuBar(mb);
          setSize(100, 100);
          setLayout(new BorderLayout());

          Label l = new Label("label");
          addPopup(l, "label");
          add(l, "North");

          Panel p = new Panel();
          addPopup(p, "Panel");
          add(p, "Center");

          Button b = new Button("button");
          addPopup(b, "button");
          add(b, "South");

          show();
        }

        public void actionPerformed(ActionEvent e) {
          System.out.println("actionPerformed, event=" + e + ", mod=" + getMods(e));
          System.out.println(" command=" + e.getActionCommand());
          System.out.println(" param=" + e.paramString());
          System.out.println(" source=" + e.getSource());
        }

        String getMods(ActionEvent e) { return getMods(e.getModifiers()); }

        String getMods(MouseEvent e) { return getMods(e.getModifiers()); }

        String getMods(int mods) {
          String modstr = "";
          if ((mods & ActionEvent.SHIFT_MASK) == ActionEvent.SHIFT_MASK)
            modstr += (" SHIFT");
          if ((mods & ActionEvent.ALT_MASK) == ActionEvent.ALT_MASK)
            modstr += (" ALT");
          if ((mods & ActionEvent.CTRL_MASK) == ActionEvent.CTRL_MASK)
            modstr += (" CTRL");
          if ((mods & ActionEvent.META_MASK) == ActionEvent.META_MASK)
            modstr += (" META");
          return modstr;
        }

        public void mouseClicked (MouseEvent e) {
          mouseAction("mouseClicked", e);
        }

        public void mouseEntered (MouseEvent e) {
          // System.out.println("mouseEntered " + e);
          // printMods(e.getModifiers());
        }

        public void mouseExited (MouseEvent e) {
          // System.out.println("mouseExited " + e);
          // printMods(e.getModifiers());
        }

        public void mousePressed (MouseEvent e) {
          mouseAction("mousePressed", e);
          // System.out.println("mousePressed " + e);
          // printMods(e.getModifiers());
        }

        public void mouseReleased (MouseEvent e) {
          mouseAction("mouseReleased", e);
          // System.out.println("mouseReleased " + e);
          // printMods(e.getModifiers());
        }

        void mouseAction (String which, MouseEvent e) {
          Component c = e.getComponent();
          System.out.println(which + "e=" + e + ", mods=" + getMods(e) +
                             ", component=" + c);
          if (e.isPopupTrigger()) {
            System.out.println("isPopup");
            PopupMenu pm = getHash(c);
            pm.show(c, c.getSize().width/2, c.getSize().height/2);
          }
        }


        void addPopup(Component c, String name) {
          PopupMenu pm = new PopupMenu();
          MenuItem mi = new MenuItem(name + "-1");
          mi.addActionListener(this);
          pm.add(mi);

          mi = new MenuItem(name + "-2");
          pm.add(mi);

          setHash(c, pm);
          c.add(pm);
          c.addMouseListener(this);
        }


        Hashtable popupTable = new Hashtable();

        void setHash(Component c, PopupMenu p) {
          popupTable.put(c, p);
        }

        PopupMenu getHash(Component c) {
          return (PopupMenu)(popupTable.get(c));
        }

      }

      Stack backtrace:
      SIGSEGV 11* segmentation violation
          si_signo [11]: SIGSEGV 11* segmentation violation
          si_errno [0]: Error 0
          si_code [1]: SEGV_MAPERR [addr: 0x4]

              stackpointer=fe704a74

      Full thread dump Classic VM (JDK-1.2.2-H, native threads):
          "Screen Updater" (TID:0xfacc0720, sys_thread_t:0x533280, state:CW, native ID:0xa) prio=4
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java, Compiled Code)
              at sun.awt.ScreenUpdater.nextEntry(ScreenUpdater.java, Compiled Code)
              at sun.awt.ScreenUpdater.run(ScreenUpdater.java, Compiled Code)
          "Thread-0" (TID:0xfacb8d28, sys_thread_t:0x2ee50, state:CW, native ID:0x1) prio=5
          "AWT-Motif" (TID:0xfacc0500, sys_thread_t:0x4ca430, state:MW, native ID:0x9) prio=5
              at sun.awt.motif.MToolkit.run(Native Method)
              at java.lang.Thread.run(Thread.java, Compiled Code)
          "SunToolkit.PostEventQueue-0" (TID:0xfacc0518, sys_thread_t:0x4ac8a8, state:CW, native ID:0x8) prio=5
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java, Compiled Code)
              at sun.awt.PostEventQueue.run(SunToolkit.java, Compiled Code)
          "AWT-EventQueue-0" (TID:0xfacc08f8, sys_thread_t:0x4a1af8, state:R, native ID:0x7) prio=6
              at sun.awt.motif.MPopupMenuPeer.pShow(Native Method)
              at sun.awt.motif.MPopupMenuPeer.show(MPopupMenuPeer.java, Compiled Code)
              at java.awt.PopupMenu.show(PopupMenu.java, Compiled Code)
              at action4.mouseAction(action4.java, Compiled Code)
              at action4.mousePressed(action4.java, Compiled Code)
              at java.awt.Component.processMouseEvent(Component.java, Compiled Code)
              at java.awt.Component.processEvent(Component.java, Compiled Code)
              at java.awt.Container.processEvent(Container.java, Compiled Code)
              at java.awt.Component.dispatchEventImpl(Component.java, Compiled Code)
              at java.awt.Container.dispatchEventImpl(Container.java, Compiled Code)
              at java.awt.Component.dispatchEvent(Component.java, Compiled Code)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java, Compiled Code)
              at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java, Compiled Code)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java, Compiled Code)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java, Compiled Code)
          "Finalizer" (TID:0xfac98320, sys_thread_t:0x6e2b0, state:CW, native ID:0x6) prio=8
              at java.lang.Object.wait(Native Method)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java, Compiled Code)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java, Compiled Code)
              at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:174)
          "Reference Handler" (TID:0xfac983b0, sys_thread_t:0x6c748, state:CW, native ID:0x5)
       prio=10
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java, Compiled Code)
              at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:114)
          "Signal dispatcher" (TID:0xfac983e0, sys_thread_t:0x65238, state:CW, native ID:0x4) prio=5
      Monitor Cache Dump:
          java.lang.Class@FACA95C8/FAD40018: owner "AWT-EventQueue-0" (0x4a1af8) 1 entry
              Waiting to enter:
                  "AWT-Motif" (0x4ca430)
          sun.awt.ScreenUpdater@FACC0720/FADAE7D0: <unowned>
              Waiting to be notified:
                  "Screen Updater" (0x533280)
          sun.awt.PostEventQueue@FACC0518/FAD7D5D8: <unowned>
              Waiting to be notified:
                  "SunToolkit.PostEventQueue-0" (0x4ac8a8)
          java.lang.ref.ReferenceQueue$Lock@FAC98338/FACCDCD8: <unowned>
              Waiting to be notified:
                  "Finalizer" (0x6e2b0)
          java.lang.ref.Reference$Lock@FAC983C0/FACCD8A8: <unowned>
              Waiting to be notified:
                  "Reference Handler" (0x6c748)
          java.awt.Component$AWTTreeLock@FACA0020/FACFC838: owner "AWT-EventQueue-0" (0x4a1af8) 1 entry
      Registered Monitor Dump:
          PCMap lock: <unowned>
          utf8 hash table: <unowned>
          JNI pinning lock: <unowned>
          JNI global reference lock: <unowned>
          BinClass lock: <unowned>
          Class linking lock: <unowned>
          System class loader lock: <unowned>
          Code rewrite lock: <unowned>
          Heap lock: <unowned>
          Monitor cache lock: owner "AWT-EventQueue-0" (0x4a1af8) 1 entry
          Thread queue lock: owner "AWT-EventQueue-0" (0x4a1af8) 1 entry
              Waiting to be notified:
                  "Thread-0" (0x2ee50)
          Monitor registry: owner "AWT-EventQueue-0" (0x4a1af8) 1 entry

      SIGABRT 6* abort (generated by abort(3) routine)
          si_signo [6]: SIGABRT 6* abort (generated by abort(3) routine)
          si_errno [0]: Error 0
          si_code [-1]: SI_LWP [pid: 19408, uid: 71346]
              stackpointer=fe704244

      Full thread dump Classic VM (JDK-1.2.2-H, native threads):
          "Screen Updater" (TID:0xfacc0720, sys_thread_t:0x533280, state:CW, native ID:0xa) prio=4
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java, Compiled Code)
              at sun.awt.ScreenUpdater.nextEntry(ScreenUpdater.java, Compiled Code)
              at sun.awt.ScreenUpdater.run(ScreenUpdater.java, Compiled Code)
          "Thread-0" (TID:0xfacb8d28, sys_thread_t:0x2ee50, state:CW, native ID:0x1) prio=5
          "AWT-Motif" (TID:0xfacc0500, sys_thread_t:0x4ca430, state:MW, native ID:0x9) prio=5
              at sun.awt.motif.MToolkit.run(Native Method)
              at java.lang.Thread.run(Thread.java, Compiled Code)
          "SunToolkit.PostEventQueue-0" (TID:0xfacc0518, sys_thread_t:0x4ac8a8, state:CW, native ID:0x8) prio=5
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java, Compiled Code)
              at sun.awt.PostEventQueue.run(SunToolkit.java, Compiled Code)
          "AWT-EventQueue-0" (TID:0xfacc08f8, sys_thread_t:0x4a1af8, state:R, native ID:0x7) prio=6
              at sun.awt.motif.MPopupMenuPeer.pShow(Native Method)
              at sun.awt.motif.MPopupMenuPeer.show(MPopupMenuPeer.java, Compiled Code)
              at java.awt.PopupMenu.show(PopupMenu.java, Compiled Code)
              at action4.mouseAction(action4.java, Compiled Code)
              at action4.mousePressed(action4.java, Compiled Code)
              at java.awt.Component.processMouseEvent(Component.java, Compiled Code)
              at java.awt.Component.processEvent(Component.java, Compiled Code)
              at java.awt.Container.processEvent(Container.java, Compiled Code)
              at java.awt.Component.dispatchEventImpl(Component.java, Compiled Code)
              at java.awt.Container.dispatchEventImpl(Container.java, Compiled Code)
              at java.awt.Component.dispatchEvent(Component.java, Compiled Code)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java, Compiled Code)
              at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java, Compiled Code)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java, Compiled Code)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java, Compiled Code)
          "Finalizer" (TID:0xfac98320, sys_thread_t:0x6e2b0, state:CW, native ID:0x6) prio=8
              at java.lang.Object.wait(Native Method)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java, Compiled Code)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java, Compiled Code)
              at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:174)
          "Reference Handler" (TID:0xfac983b0, sys_thread_t:0x6c748, state:CW, native ID:0x5) prio=10
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java, Compiled Code)
              at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:114)
          "Signal dispatcher" (TID:0xfac983e0, sys_thread_t:0x65238, state:CW, native ID:0x4)
       prio=5
      Monitor Cache Dump:
          java.lang.Class@FACA95C8/FAD40018: owner "AWT-EventQueue-0" (0x4a1af8) 1 entry
              Waiting to enter:
                  "AWT-Motif" (0x4ca430)
          sun.awt.ScreenUpdater@FACC0720/FADAE7D0: <unowned>
              Waiting to be notified:
                  "Screen Updater" (0x533280)
          sun.awt.PostEventQueue@FACC0518/FAD7D5D8: <unowned>
              Waiting to be notified:
                  "SunToolkit.PostEventQueue-0" (0x4ac8a8)
          java.lang.ref.ReferenceQueue$Lock@FAC98338/FACCDCD8: <unowned>
              Waiting to be notified:
                  "Finalizer" (0x6e2b0)
          java.lang.ref.Reference$Lock@FAC983C0/FACCD8A8: <unowned>
              Waiting to be notified:
                  "Reference Handler" (0x6c748)
          java.awt.Component$AWTTreeLock@FACA0020/FACFC838: owner "AWT-EventQueue-0" (0x4a1af8) 1 entry
      Registered Monitor Dump:
          PCMap lock: <unowned>
          utf8 hash table: <unowned>
          JNI pinning lock: <unowned>
          JNI global reference lock: <unowned>
          BinClass lock: <unowned>
          Class linking lock: <unowned>
          System class loader lock: <unowned>
          Code rewrite lock: <unowned>
          Heap lock: <unowned>
          Monitor cache lock: owner "AWT-EventQueue-0" (0x4a1af8) 1 entry
          Thread queue lock: owner "AWT-EventQueue-0" (0x4a1af8) 1 entry
              Waiting to be notified:
                  "Thread-0" (0x2ee50)
          Monitor registry: owner "AWT-EventQueue-0" (0x4a1af8) 1 entry

            mbronsonsunw Mike Bronson (Inactive)
            dmendenhsunw David Mendenhall (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: