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

PIT. JVM does not exit when TrayIcon is added and then removed

XMLWordPrintable

    • b81
    • 6
    • b83
    • generic, x86
    • generic, solaris_10
    • Verified

      This occurs only with b81 PIT build on Solaris and Linux platforms.

      I have a java program which adds a TrayIcon to the system tray and then removes it. The java process does not exit even after the TrayIcon is removed. Below is the java program I execute:

      import java.awt.*;
      import java.awt.image.BufferedImage;

      public class TrayIconTest {
          public static void main(String[] args) {
              try {
                  SystemTray st = SystemTray.getSystemTray();
                  BufferedImage image = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
                  Graphics gr = image.createGraphics();
                  gr.setColor(Color.white);
                  gr.fillRect(0, 0, 16, 16);
                  TrayIcon icon = new TrayIcon(image);
                  st.add(icon);
                  st.remove(icon);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }

      Below is the threaddump when the process does not exit:

      2006-04-13 14:54:30
      Full thread dump Java HotSpot(TM) Client VM (1.6.0-beta2-b78 mixed mode):

      "AWT-XAWT" daemon prio=10 tid=0x08305400 nid=0x201f runnable [0x4ac33000..0x4ac33580]
         java.lang.Thread.State: RUNNABLE
              at sun.awt.X11.XToolkit.waitForEvents(Native Method)
              at sun.awt.X11.XToolkit.run(XToolkit.java:584)
              at sun.awt.X11.XToolkit.run(XToolkit.java:559)
              at java.lang.Thread.run(Thread.java:618)

      "Java2D Disposer" daemon prio=10 tid=0x082da400 nid=0x201e in Object.wait() [0x4abb5000..0x4abb5700]
         java.lang.Thread.State: WAITING (on object monitor)
              at java.lang.Object.wait(Native Method)
              - waiting on <0x423d04e8> (a java.lang.ref.ReferenceQueue$Lock)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
              - locked <0x423d04e8> (a java.lang.ref.ReferenceQueue$Lock)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
              at sun.java2d.Disposer.run(Disposer.java:125)
              at java.lang.Thread.run(Thread.java:618)

      "Low Memory Detector" daemon prio=10 tid=0x080c4c00 nid=0x201c runnable [0x00000000..0x00000000]
         java.lang.Thread.State: RUNNABLE

      "CompilerThread0" daemon prio=10 tid=0x080c3400 nid=0x201b waiting on condition [0x00000000..0x4a732208]
         java.lang.Thread.State: RUNNABLE

      "Signal Dispatcher" daemon prio=10 tid=0x080c2000 nid=0x201a waiting on condition [0x00000000..0x00000000]
         java.lang.Thread.State: RUNNABLE

      "Finalizer" daemon prio=10 tid=0x080a8400 nid=0x2019 in Object.wait() [0x4a627000..0x4a627480]
         java.lang.Thread.State: WAITING (on object monitor)
              at java.lang.Object.wait(Native Method)
              - waiting on <0x423d06d0> (a java.lang.ref.ReferenceQueue$Lock)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
              - locked <0x423d06d0> (a java.lang.ref.ReferenceQueue$Lock)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
              at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

      "Reference Handler" daemon prio=10 tid=0x080a7400 nid=0x2018 in Object.wait() [0x4a5d6000..0x4a5d6600]
         java.lang.Thread.State: WAITING (on object monitor)
              at java.lang.Object.wait(Native Method)
              - waiting on <0x423d0760> (a java.lang.ref.Reference$Lock)
              at java.lang.Object.wait(Object.java:484)
              at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
              - locked <0x423d0760> (a java.lang.ref.Reference$Lock)

      "main" prio=10 tid=0x08058800 nid=0x2016 in Object.wait() [0x401c8000..0x401c88d8]
         java.lang.Thread.State: WAITING (on object monitor)
              at java.lang.Object.wait(Native Method)
              - waiting on <0x423142d0> (a sun.awt.SunToolkit$1AWTInvocationLock)
              at java.lang.Object.wait(Object.java:484)
              at sun.awt.SunToolkit.executeOnEDTAndWait(SunToolkit.java:691)
              - locked <0x423142d0> (a sun.awt.SunToolkit$1AWTInvocationLock)
              at sun.awt.X11.XTrayIconPeer.dispose(XTrayIconPeer.java:221)
              at java.awt.TrayIcon.removeNotify(TrayIcon.java:662)
              at java.awt.SystemTray.remove(SystemTray.java:276)
              - locked <0x423d0a40> (a java.awt.SystemTray)
              at TrayIconTest.main(TrayIconTest.java:14)

      "VM Thread" prio=10 tid=0x080a4000 nid=0x2017 runnable

      "VM Periodic Task Thread" prio=10 tid=0x080c6400 nid=0x201d waiting on condition

      JNI global references: 680

      Heap
       def new generation total 960K, used 332K [0x422e0000, 0x423e0000, 0x427c0000) eden space 896K, 29% used [0x422e0000, 0x42323018, 0x423c0000)
        from space 64K, 100% used [0x423d0000, 0x423e0000, 0x423e0000)
        to space 64K, 0% used [0x423c0000, 0x423c0000, 0x423d0000)
       tenured generation total 4096K, used 292K [0x427c0000, 0x42bc0000, 0x462e0000)
         the space 4096K, 7% used [0x427c0000, 0x42809210, 0x42809400, 0x42bc0000)
       compacting perm gen total 12288K, used 5793K [0x462e0000, 0x46ee0000, 0x4a2e0000)
         the space 12288K, 47% used [0x462e0000, 0x46888790, 0x46888800, 0x46ee0000)
      No shared spaces configured.

            dcherepanov Dmitry Cherepanov
            gramachasunw Girish Ramachandran (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: