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

Exception thrown when new focus code sends message to disposed AppContext

XMLWordPrintable

    • sparc
    • solaris_8

      There is an inherent race condition between the DefaultKeyboardFocusManager and
      the new architecture which fixed BugID 4051487. The DefaultKeyboardFocusManager
      can in some situations attempt to send a message to an AppContext which has
      already been disposed. Because the fix for 4051487 shuts down
      EventDispatchThreads when they are not being used, the code will try to start
      up a new EventDispatchThread in response to the sent message. However, since
      the new Thread's AppContext's ThreadGroup has been destroyed, this operation
      will fail. ThreadGroup.add explicitly checks to see if the ThreadGroup has
      been destroyed, and throws an exception in that case.

      To reproduce this problem, run any applet in appletviewer. The exception will
      be thrown when closing appletviewer. I reproduced this bug while running one of
      the Animator applets under a heavy processor load on Solaris. I also had several
      applets running simulataneously under the same appletviewer process. However, I
      suspect this bug could be reproduced in any circumstance on any platform.

      The exception I saw looked like this:

      Exception occurred during event dispatching:
      java.lang.IllegalThreadStateException
              at java.lang.ThreadGroup.add(ThreadGroup.java:801)
              at java.lang.Thread.init(Thread.java:279)
              at java.lang.Thread.<init>(Thread.java:390)
              at java.awt.EventDispatchThread.<init>(EventDispatchThread.java:49)
              at java.awt.EventQueue$1.run(EventQueue.java:564)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.awt.EventQueue.initDispatchThread(EventQueue.java:561)
              at java.awt.EventQueue.wakeup(EventQueue.java:711)
              at sun.awt.SunToolkit.wakeupEventQueue(Native Method)
              at sun.awt.PostEventQueue.postEvent(SunToolkit.java:594)
              at sun.awt.SunToolkit.postEvent(SunToolkit.java:230)
              at java.awt.DefaultKeyboardFocusManager.sendMessage(DefaultKeyboardFocusManager.java:167)
              at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:508)
              at java.awt.Component.dispatchEventImpl(Component.java:2783)
              at java.awt.Container.dispatchEventImpl(Container.java:1309)
              at java.awt.Window.dispatchEventImpl(Window.java:1228)
              at java.awt.Component.dispatchEvent(Component.java:2764)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:423)
              at java.awt.SentEvent.dispatch(SentEvent.java:52)
              at java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch(DefaultKeyboardFocusManager.java:143)
              at java.awt.DefaultKeyboardFocusManager.sendMessage(DefaultKeyboardFocusManager.java:165)
              at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:236)
              at java.awt.Component.dispatchEventImpl(Component.java:2783)
              at java.awt.Container.dispatchEventImpl(Container.java:1309)
              at java.awt.Window.dispatchEventImpl(Window.java:1228)
              at java.awt.Component.dispatchEvent(Component.java:2764)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:423)
              at java.awt.SequencedEvent.dispatch(SequencedEvent.java:96)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:421)
              at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:136)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:122)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:118)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)

            ibdsunw Ibd Ibd (Inactive)
            dmendenhsunw David Mendenhall (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: