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

awt eventqueue has problem in handling robot events

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.3.1_01
    • client-libs
    • sparc
    • solaris_8

      This bug only appears in JDK 1.3 train. It can't be reproduced in Merlin.
      So file it as low priority.

      The following is the demo code:

      import java.awt.event.*;


      public class robTest {

          public static void main (String args[]) {
              robotThread r = new robotThread();
              r.start();
          }

      }

      /* robotThread is used to control key press sequences. */
      class robotThread extends Thread {
          private java.awt.Robot rob;
          private static int INTERVAL = 10;
          public robotThread() {
              try {
                  rob = new java.awt.Robot();
              } catch (java.awt.AWTException e) {
                  System.err.println("Failed to create Robot.");
              }
          }
          
          public void run() {
              System.out.println("Robot started");
              try {
                  sleep(INTERVAL * 1000);
                  rob.keyPress(KeyEvent.VK_ENTER);
                  System.out.println("Enter Key Pressed");
                  rob.keyRelease(KeyEvent.VK_ENTER);
                  System.out.println("Enter Key Released");
              } catch (InterruptedException e) {
              }
          }
      }


      compile it and run it. Program will hang after the Enter key is released, using
      1.3* release. Program will exit using Merlin.

      The following is the thread dumps:
      Solaris:
      =========
      [comanche:yuwang:tcsh:~/temp] > Full thread dump:

      "Thread-1" prio=5 tid=0x282b8 nid=0x1 runnable [0..0xffbee320]

      "AWT-Motif" prio=6 tid=0x1f2d88 nid=0xd runnable [0xf4601000..0xf46019e0]
              at sun.awt.motif.MToolkit.run(Native Method)
              at java.lang.Thread.run(Thread.java:484)

      "SunToolkit.PostEventQueue-0" prio=6 tid=0x1e6fe0 nid=0xc waiting on monitor [0xf4701000..0xf47019e0]
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java:420)
              at sun.awt.PostEventQueue.run(SunToolkit.java:497)

      "AWT-EventQueue-0" prio=6 tid=0x1e6eb8 nid=0xb waiting on monitor [0xf4801000..0xf48019e0]
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java:420)
              at java.awt.EventQueue.getNextEvent(EventQueue.java:254)
              at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:101)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)

      "Signal Dispatcher" daemon prio=10 tid=0x97f10 nid=0x9 runnable [0..0]

      "Finalizer" daemon prio=8 tid=0x94748 nid=0x7 waiting on monitor [0xfd181000..0xfd1819e0]
              at java.lang.Object.wait(Native Method)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:149)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
              at java.lang.ref.Finalizer$FinalizerWorker$FinalizerThread.run(Finalizer.java:120)

      "Reference Handler" daemon prio=10 tid=0x92e10 nid=0x6 waiting on monitor [0xfd281000..0xfd2819e0]
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java:420)
              at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:129)

      "VM Thread" prio=5 tid=0x921b0 nid=0x4 runnable

      "VM Periodic Task Thread" prio=10 tid=0x96588 nid=0x8 waiting on monitor


      Windows:
      ========
      Full thread dump:

      "Thread-2" prio=5 tid=0x234598 nid=0x4d8 waiting on monitor [0..0x6fb30]

      "AWT-Windows" prio=7 tid=0x827e28 nid=0x5a0 runnable [0x8e0f000..0x8e0fdbc]
              at sun.awt.windows.WToolkit.eventLoop(Native Method)
              at sun.awt.windows.WToolkit.run(WToolkit.java:188)
              at java.lang.Thread.run(Thread.java:484)

      "SunToolkit.PostEventQueue-0" prio=7 tid=0x827720 nid=0x5bc waiting on monitor [0x8dcf000..0x8dcfdbc]
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java:420)
              at sun.awt.PostEventQueue.run(SunToolkit.java:491)

      "AWT-EventQueue-0" prio=7 tid=0x8a9c38 nid=0x5b8 waiting on monitor [0x8d8f000..0x8d8fdbc]
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java:420)
              at java.awt.EventQueue.getNextEvent(EventQueue.java:260)
              at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:106)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)

      "Signal Dispatcher" daemon prio=10 tid=0x8001c0 nid=0x5b0 waiting on monitor [0..0]

      "Finalizer" daemon prio=9 tid=0x8990ec0 nid=0x5a4 waiting on monitor [0x8c4f000..0x8c4fdbc]
              at java.lang.Object.wait(Native Method)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:108)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:123)
              at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:162)

      "Reference Handler" daemon prio=10 tid=0x8990238 nid=0x578 waiting on monitor [0x8c0f000..0x8c0fdbc]
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java:420)
              at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:110)

      "VM Thread" prio=5 tid=0x89fe088 nid=0x5c0 runnable

      "VM Periodic Task Thread" prio=10 tid=0x7fee98 nid=0x5a8 waiting on monitor
      "Suspend Checker Thread" prio=10 tid=0x7ff810 nid=0x5ac runnable

      ###@###.### 2001-10-23

            dav Andrei Dmitriev (Inactive)
            nwangsunw Nathan Wang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: