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

deadlock between two AWT-EventQueue threads

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P2 P2
    • None
    • 6u6
    • client-libs
    • sparc
    • solaris_9

      This is from customer's radiance case #65913223

      Data location: /net/cores.central/cores/dir4/65913223
      (including java stack traces, corefile and libraries)

      Here's the java level deadlock:

      Found one Java-level deadlock:
      =============================
      "AWT-EventQueue-2":
        waiting to lock monitor 0x000547a8 (object 0xd0b8c128, a java.awt.Component$AWTTreeLock),
        which is held by "AWT-EventQueue-0"
      "AWT-EventQueue-0":
        waiting to lock monitor 0x001e0860 (object 0xd263a370, a com.smarts.viewer.SmTableMultiSorter),
        which is held by "AWT-EventQueue-2"

      Java stack information for the threads listed above:
      ===================================================
      "AWT-EventQueue-2":
          at java.awt.Component.invalidate(Unknown Source)
          - waiting to lock <0xd0b8c128> (a java.awt.Component$AWTTreeLock)
          at java.awt.Container.invalidate(Unknown Source)
          at javax.swing.JComponent.revalidate(Unknown Source)
          at javax.swing.JTable.resizeAndRepaint(Unknown Source)
          at javax.swing.JTable.tableChanged(Unknown Source)
          at com.smarts.viewer.util.SmCellSortableTable.tableChanged(SmCellSortableTable.java:707)
          at com.smarts.viewer.consolidation.notiflist.SmMultiSortableTable.tableChanged(SmMultiSortableTable.java:823)
          at com.smarts.viewer.util.SmAbstractTableModel.fireTableChanged(SmAbstractTableModel.java:47)
          at javax.swing.table.AbstractTableModel.fireTableDataChanged(Unknown Source) at com.smarts.viewer.SmCellTableSorter.sortCommon(SmCellTableSorter.java:622)
          - locked <0xd263a370> (a com.smarts.viewer.SmTableMultiSorter)
          at com.smarts.viewer.SmCellTableSorter.tableChanged(SmCellTableSorter.java:287)
          - locked <0xd263a370> (a com.smarts.viewer.SmTableMultiSorter)
          at com.smarts.viewer.util.SmAbstractTableModel.fireTableChanged(SmAbstractTableModel.java:47)
          at javax.swing.table.AbstractTableModel.fireTableDataChanged(Unknown Source) at com.smarts.viewer.consolidation.notiflist.SmNLTableModel.initTableModel(SmNLTableModel.java:257)
          at com.smarts.viewer.consolidation.notiflist.SmNLTableModel.setNotificationList(SmNLTableModel.java:218)
          at com.smarts.viewer.consolidation.notiflist.SmNotificationListView.startListeningToContext(SmNotificationListView.java:2696)
          at com.smarts.viewer.webconsoles.SmWebConsole.makeViewListenTo(SmWebConsole.java:205)
          at com.smarts.webapps.SmWebApp.startListeningToContext(SmWebApp.java:322)
          at com.smarts.webapps.SmWebApp$1.run(SmWebApp.java:371)
          at java.awt.event.InvocationEvent.dispatch(Unknown Source)
          at java.awt.EventQueue.dispatchEvent(Unknown Source)
          at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
          at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
          at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
          at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
          at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
          at java.awt.EventDispatchThread.run(Unknown Source)


      "AWT-EventQueue-0":
          at com.smarts.viewer.SmTableMultiSorter.getValueAt(SmTableMultiSorter.java:169)
          - waiting to lock <0xd263a370> (a com.smarts.viewer.SmTableMultiSorter)
          at javax.swing.JTable.getValueAt(Unknown Source)
          at javax.swing.JTable.prepareRenderer(Unknown Source)
          at javax.swing.plaf.basic.BasicTableUI.paintCell(Unknown Source)
          at javax.swing.plaf.basic.BasicTableUI.paintCells(Unknown Source)
          at javax.swing.plaf.basic.BasicTableUI.paint(Unknown Source)
          at javax.swing.plaf.ComponentUI.update(Unknown Source)
          at javax.swing.JComponent.paintComponent(Unknown Source)
          at javax.swing.JComponent.paint(Unknown Source)
          at com.smarts.viewer.util.SmCellSortableTable.paint(SmCellSortableTable.java:888)
          at javax.swing.JComponent.paintChildren(Unknown Source)
          - locked <0xd0b8c128> (a java.awt.Component$AWTTreeLock)
          at javax.swing.JComponent.paint(Unknown Source)
          at javax.swing.JViewport.paint(Unknown Source)
          at javax.swing.JComponent.paintChildren(Unknown Source)
          - locked <0xd0b8c128> (a java.awt.Component$AWTTreeLock)
          at javax.swing.JComponent.paint(Unknown Source)
          at javax.swing.JComponent.paintChildren(Unknown Source)
          - locked <0xd0b8c128> (a java.awt.Component$AWTTreeLock)
          at javax.swing.JComponent.paint(Unknown Source)
          at javax.swing.JComponent.paintChildren(Unknown Source)
          - locked <0xd0b8c128> (a java.awt.Component$AWTTreeLock)
          at javax.swing.JComponent.paint(Unknown Source)
          at javax.swing.JComponent.paintChildren(Unknown Source)
          - locked <0xd0b8c128> (a java.awt.Component$AWTTreeLock)
          at javax.swing.JComponent.paint(Unknown Source)
          at javax.swing.JComponent.paintToOffscreen(Unknown Source)
          at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
          at javax.swing.RepaintManager.paint(Unknown Source)
          at javax.swing.JComponent._paintImmediately(Unknown Source)
          at javax.swing.JComponent.paintImmediately(Unknown Source)
          at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
          at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
          at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
          at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
          at java.awt.event.InvocationEvent.dispatch(Unknown Source)
          at java.awt.EventQueue.dispatchEvent(Unknown Source)
          at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
          at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
          at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
          at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
          at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
          at java.awt.EventDispatchThread.run(Unknown Source)

      Found 1 deadlock.
      Questions from customer:

      Once upon a time (a long time ago) our GUI was
      multithreaded and had lots of synchronized methods. This never worked
      properly as it was too tricky to build a multithreaded UI over a non
      thread safe toolkit like Swing. So, we changed to doing everything that
      could result in painting via SwingUtilities.invokeLater or
      invokeAndWait. We had always assumed that since there is only one
      AWTEventQueue thread, and the invokeLater and invokeAndWait guarantee
      that you execute on that thread, we didn't need to worry about the
      residual synchronized methods from our old multithreaded approach. Now
      we are surprised to find multiple AWTEventQueues resulting in our
      synchronized methods now being a potential source of deadlocks. I guess
      that leaves us with the following question: SwingUtilities.invokeLater
      is a static method. If there are multiple AWTEventQueues, how does
      invokeLater decide which AWTEventQueue thread to run the Runnable that
      is passed into it on? If we remove all the synchronization that is in
      place, how can we be sure that 2 different Runnables that should be run
      on the same AWTEventQueue thread won't actually end up on two different
      threads, causing a potential thread safety issue?

            dcherepanov Dmitry Cherepanov
            lkchow Lawrence Chow
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: