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

Java AWT thread freeze when java.awt.Component requestFocus: Peer request failed

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      ADDITIONAL SYSTEM INFORMATION :
      OS: Windows 7 x64
      JDK: jdk1.8.0_144

      A DESCRIPTION OF THE PROBLEM :
      Java AWT thread freezes when modal dialog is displayed after a keyboard key event.

      AWT stacktrace:
      "AWT-EventQueue-0@1633" prio=6 tid=0x13 nid=NA waiting
        java.lang.Thread.State: WAITING
      at sun.misc.Unsafe.park(Unsafe.java:-1)
      at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
      at java.awt.EventQueue.getNextEvent(EventQueue.java:608)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:170)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
      at java.awt.SequencedEvent.dispatch(SequencedEvent.java:107)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
      at java.awt.EventQueue.access$500(EventQueue.java:97)
      at java.awt.EventQueue$3.run(EventQueue.java:709)
      at java.awt.EventQueue$3.run(EventQueue.java:703)
      at java.security.AccessController.doPrivileged(AccessController.java:-1)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
      at java.awt.EventQueue$4.run(EventQueue.java:731)
      at java.awt.EventQueue$4.run(EventQueue.java:729)
      at java.security.AccessController.doPrivileged(AccessController.java:-1)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
      at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:184)
      at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:229)
      at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:227)
      at java.security.AccessController.doPrivileged(AccessController.java:-1)
      at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:227)
      at java.awt.Dialog.show(Dialog.java:1084)
      at java.awt.Component.show(Component.java:1671)
      at java.awt.Component.setVisible(Component.java:1623)
      at java.awt.Window.setVisible(Window.java:1014)
      at java.awt.Dialog.setVisible(Dialog.java:1005)
      at com.bet.gui.table.common.StringFilterCallback.getCustomValue(StringFilterCallback.java:84)
      at com.bet.gui.table.BTable.setActiveFilter(BTable.java:1495)
      at com.bet.gui.table.BTable$12.actionPerformed(BTable.java:818)
      at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1258)
      at javax.swing.JComboBox.setSelectedItem(JComboBox.java:586)
      at com.bet.gui.comboBox.BComboBoxEx.setSelectedItem(BComboBoxEx.java:215)
      at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:622)
      at javax.swing.plaf.basic.BasicComboBoxUI.selectNextPossibleValue(BasicComboBoxUI.java:1125)
      at javax.swing.plaf.basic.BasicComboBoxUI$Actions.actionPerformed(BasicComboBoxUI.java:1511)
      at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1663)
      at javax.swing.JComponent.processKeyBinding(JComponent.java:2882)
      at javax.swing.JComboBox.processKeyBinding(JComboBox.java:1426)
      at javax.swing.JComponent.processKeyBindings(JComponent.java:2943)
      at javax.swing.JComponent.processKeyEvent(JComponent.java:2845)
      at javax.swing.JComboBox.processKeyEvent(JComboBox.java:1418)
      at java.awt.Component.processEvent(Component.java:6310)
      at java.awt.Container.processEvent(Container.java:2236)
      at java.awt.Component.dispatchEventImpl(Component.java:4889)
      at java.awt.Container.dispatchEventImpl(Container.java:2294)
      at java.awt.Component.dispatchEvent(Component.java:4711)
      at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954)
      at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:806)
      at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1074)
      at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:945)
      at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:771)
      at java.awt.Component.dispatchEventImpl(Component.java:4760)
      at java.awt.Container.dispatchEventImpl(Container.java:2294)
      at java.awt.Window.dispatchEventImpl(Window.java:2746)
      at java.awt.Component.dispatchEvent(Component.java:4711)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
      at java.awt.EventQueue.access$500(EventQueue.java:97)
      at java.awt.EventQueue$3.run(EventQueue.java:709)
      at java.awt.EventQueue$3.run(EventQueue.java:703)
      at java.security.AccessController.doPrivileged(AccessController.java:-1)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
      at java.awt.EventQueue$4.run(EventQueue.java:731)
      at java.awt.EventQueue$4.run(EventQueue.java:729)
      at java.security.AccessController.doPrivileged(AccessController.java:-1)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

      Also, some AWT debugging was added and we got the following:
      AWT-EventQueue-0 CERROR 04-20 17:16:59,897: Apr 20, 2018 5:16:59 PM java.awt.Window setGraphicsConfiguration
      FINER: + Window.setGraphicsConfiguration(): new GC is
      + sun.awt.Win32GraphicsConfig@4313f5bc[dev=Win32GraphicsDevice[screen=0],pixfmt=0]
      + this is com.bet.gui.util.CustomFilterDialog[dialog54,0,0,0x0,invalid,hidden,null,defaultCloseOperation=DO_NOTHING_ON_CLOSE,rootPane=,rootPaneCheckingEnabled=false]

      AWT-EventQueue-0 CERROR 04-20 17:16:59,924: Apr 20, 2018 5:16:59 PM java.awt.Window setGraphicsConfiguration
      FINER: + Window.setGraphicsConfiguration(): new GC is
      + sun.awt.Win32GraphicsConfig@494f7f0f[dev=Win32GraphicsDevice[screen=3],pixfmt=0]
      + this is com.bet.gui.util.CustomFilterDialog[CustomFilterDialog,-647,211,355x340,layout=java.awt.BorderLayout,APPLICATION_MODAL,title=Define custom filter,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,0,0,355x340,layout=com.didi.plaf.DidiRootPaneUI$RootPaneLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.border.CompoundBorder@47d8ff09,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]

      SwingCheckerTimer ERROR 04-20 17:17:01,504: Increasing the weight to: 460
      AWT-EventQueue-0 CERROR 04-20 17:17:01,609: Apr 20, 2018 5:17:01 PM java.awt.Component transferFocus
      FINER: clearOnFailure = false

      AWT-EventQueue-0 CERROR 04-20 17:17:01,609: Apr 20, 2018 5:17:01 PM java.awt.Component getNextFocusCandidate
      FINER: comp = com.bet.gui.table.ColumnHeaderPanel[,1750,0,74x36,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=], root = com.bet.blues.gui.OrderPanel[SB,0,1,2118x1277,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777225,maximumSize=,minimumSize=,preferredSize=]

      AWT-EventQueue-0 CERROR 04-20 17:17:01,610: Apr 20, 2018 5:17:01 PM java.awt.Component getNextFocusCandidate
      FINER: component after is com.bet.gui.table.BTable[OrderTable,0,0,7440x96,alignmentX=0.0,alignmentY=0.0,border=,flags=251658568,maximumSize=,minimumSize=,preferredSize=,autoCreateColumnsFromModel=true,autoResizeMode=AUTO_RESIZE_OFF,cellSelectionEnabled=false,editingColumn=-1,editingRow=-1,gridColor=java.awt.Color[r=160,g=160,b=160],preferredViewportSize=java.awt.Dimension[width=450,height=400],rowHeight=16,rowMargin=1,rowSelectionAllowed=true,selectionBackground=java.awt.Color[r=164,g=168,b=177],selectionForeground=java.awt.Color[r=48,g=48,b=48],showHorizontalLines=true,showVerticalLines=false]

      AWT-EventQueue-0 CERROR 04-20 17:17:01,610: Apr 20, 2018 5:17:01 PM java.awt.Component getNextFocusCandidate
      FINER: Focus transfer candidate: com.bet.gui.table.BTable[OrderTable,0,0,7440x96,alignmentX=0.0,alignmentY=0.0,border=,flags=251658568,maximumSize=,minimumSize=,preferredSize=,autoCreateColumnsFromModel=true,autoResizeMode=AUTO_RESIZE_OFF,cellSelectionEnabled=false,editingColumn=-1,editingRow=-1,gridColor=java.awt.Color[r=160,g=160,b=160],preferredViewportSize=java.awt.Dimension[width=450,height=400],rowHeight=16,rowMargin=1,rowSelectionAllowed=true,selectionBackground=java.awt.Color[r=164,g=168,b=177],selectionForeground=java.awt.Color[r=48,g=48,b=48],showHorizontalLines=true,showVerticalLines=false]

      AWT-EventQueue-0 CERROR 04-20 17:17:01,610: Apr 20, 2018 5:17:01 PM java.awt.Component isRequestFocusAccepted
      FINEST: RequestFocusController returns true

      AWT-EventQueue-0 CERROR 04-20 17:17:01,611: Apr 20, 2018 5:17:01 PM java.awt.Component requestFocusHelper
      FINEST: Peer request failed

      AWT-EventQueue-0 CERROR 04-20 17:17:01,611: Apr 20, 2018 5:17:01 PM java.awt.Component transferFocus
      FINER: returning result: false

      AWT-EventQueue-0 CERROR 04-20 17:17:01,611: Apr 20, 2018 5:17:01 PM java.awt.Component isRequestFocusAccepted
      FINEST: RequestFocusController returns true

      AWT-EventQueue-0 CERROR 04-20 17:17:01,612: Apr 20, 2018 5:17:01 PM java.awt.Component requestFocusHelper
      FINEST: Peer request failed

      AWT-EventQueue-0 CERROR 04-20 17:17:01,612: Apr 20, 2018 5:17:01 PM java.awt.Component transferFocusBackward
      FINER: clear global focus owner

      AWT-EventQueue-0 CERROR 04-20 17:17:01,612: Apr 20, 2018 5:17:01 PM java.awt.Component transferFocusBackward
      FINER: returning result: false

      AWT-EventQueue-0 CERROR 04-20 17:17:01,756: Apr 20, 2018 5:17:01 PM java.awt.Component dispatchEventImpl
      FINEST: java.awt.FocusEvent[FOCUS_LOST,permanent,opposite=null,cause=CLEAR_GLOBAL_FOCUS_OWNER] on com.bet.gui.comboBox.BComboBoxEx[,0,18,74x18,invalid,layout=com.didi.plaf.DidiComboBoxUI$DidiComboBoxLayoutManager,alignmentX=0.0,alignmentY=0.0,border=com.bet.gui.table.ColumnHeaderPanel$ComboBoxBorder@5f59b886,flags=16777536,maximumSize=,minimumSize=,preferredSize=java.awt.Dimension[width=0,height=18],isEditable=false,lightWeightPopupEnabled=true,maximumRowCount=8,selectedItemReminder=<Custom...>]

      AWT-EventQueue-0 CERROR 04-20 17:17:01,756: Apr 20, 2018 5:17:01 PM java.awt.Component isRequestFocusAccepted
      FINEST: focus owner is null or this

      AWT-EventQueue-0 CERROR 04-20 17:17:01,756: Apr 20, 2018 5:17:01 PM java.awt.Component requestFocusHelper
      FINEST: Peer request failed

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Precondition - add debug breakpoint on AWT thread for 2 lines and start the Application in debug mode.
      (an object instance of JComboBox.java).addPopupMenuListener(new PopupMenuListener() {
                  @Override
                  public void popupMenuWillBecomeVisible(PopupMenuEvent e) {

                  }

                  @Override
                  public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
                      loseFilterFocus();// add thread breakpoint 2 here
                  }

                  @Override
                  public void popupMenuCanceled(PopupMenuEvent e) {
                      loseFilterFocus();// add thread breakpoint 1 here
                  }
              });
      2. Press down key which triggers an event to display a modal dialog
      3. Intelij idea with debug got focus for breakpoint 1 - press F9
      4. Intelij idea with debug got focus for breakpoint 2 - press F9
      5. Click somewehere in the application
      Repeat from step 2 until AWT freezes.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The application is responsive, and we can interact with the modal dialog.
      ACTUAL -
      The application is not responsive, and we cannot interact with the modal dialog. All other threads beside AWT, are working fine. If any event is posted on the AWT, it will not be processed.

      ---------- BEGIN SOURCE ----------
      Managed to reproduce this only on the production application. If there is not enough info we can try to isolate this in a smaller application. Also if you know more logging that we can enable, in order to investigate this, please let us know,
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      No workaround. The AWT is not responding at mouse clicks, keyboard events, or other threads are posting on AWT thread some events.

      FREQUENCY : often


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              serb Sergey Bylokhov
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: