SYNOPSIS
--------
Mixed Native/Java level deadlock in AWT code
OPERATING SYSTEM
----------------
Reported on Windows Server 2003 x64.
Reproduced by JLE using Windows XP, Windows Server 2008 R2 x64, Windows Server 2003 R2 x64
JDK VERSION
-----------
Regression since JDK 6u15-b01. Not reproducible using JDK 6u14.
Reproduced by JLE using JDK 6u15-b01, JDK 6u24, JDK 6u25-b02, JFB 6u24-rev-b23
PROBLEM DESCRIPTION
-------------------
Licensee has Java-based product installer which hangs randomly, but often, at different
installation steps. Once the hang occurs, the only way out is to terminate the
installer via windows task manager. The issue first appears in JDK 6u15-b01, and the
frequency appears to increase from 6u17 and above.
The hang is observed with both 32 bit and 64 bit JDKs. The installer is built on InstallShield Multi-Platform 11.5.
TESTCASE
--------
A full installer has been provided. See Comments section for Internal download link.
HUNG THREAD
----------
Here is a basic look at the hung thread. See attachments for full threaddump
produced using 6u24 fastdebug.
"AWT-EventQueue-0" prio=6 tid=0x189cc400 nid=0x674 runnable [0x192fe000]
java.lang.Thread.State: RUNNABLE
at sun.awt.windows.WFramePeer.getState(Native Method)
at java.awt.Frame.getExtendedState(Frame.java:745)
- locked <0x0989be70> (a javax.swing.JFrame)
at javax.swing.RepaintManager.addDirtyRegion0(RepaintManager.java:418)
at javax.swing.RepaintManager.addDirtyRegion(RepaintManager.java:464)
at javax.swing.JComponent.repaint(JComponent.java:4734)
at java.awt.Component.repaint(Component.java:3081)
at javax.swing.JTextField$ScrollRepainter.stateChanged(JTextField.java:836)
at javax.swing.DefaultBoundedRangeModel.fireStateChanged(DefaultBoundedRangeModel.java:348)
at javax.swing.DefaultBoundedRangeModel.setRangeProperties(DefaultBoundedRangeModel.java:285)
at javax.swing.text.FieldView.adjustAllocation(FieldView.java:84)
at javax.swing.text.FieldView.adjustPaintRegion(FieldView.java:178)
at javax.swing.text.PlainView.paint(PlainView.java:234)
at javax.swing.text.FieldView.paint(FieldView.java:171)
at javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1422)
at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:722)
at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:869)
at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:848)
at javax.swing.JComponent.paintComponent(JComponent.java:752)
at javax.swing.JComponent.paint(JComponent.java:1029)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
- locked <0x0960d9a8> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
- locked <0x0960d9a8> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
- locked <0x0960d9a8> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:567)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
- locked <0x0960d9a8> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5124)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:278)
at javax.swing.RepaintManager.paint(RepaintManager.java:1224)
at javax.swing.JComponent._paintImmediately(JComponent.java:5072)
at javax.swing.JComponent.paintImmediately(JComponent.java:4882)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:785)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:713)
at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:693)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:125)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
"AWT-Windows" daemon prio=6 tid=0x18a0e800 nid=0xcac waiting for monitor entry [0x1926f000]
java.lang.Thread.State: BLOCKED (on object monitor)
at java.awt.Frame.getExtendedState(Frame.java:743)
- waiting to lock <0x0989be70> (a javax.swing.JFrame)
at java.awt.Frame.paramString(Frame.java:915)
at javax.swing.JFrame.paramString(JFrame.java:839)
at java.awt.Component.toString(Component.java:7849)
at java.lang.String.valueOf(String.java:2826)
at java.awt.KeyboardFocusManager.shouldNativelyFocusHeavyweight(KeyboardFocusManager.java:2306)
at sun.awt.windows.WToolkit.eventLoop(Native Method)
at sun.awt.windows.WToolkit.run(WToolkit.java:293)
at java.lang.Thread.run(Thread.java:662)
LICENSEE ANALYSIS
-----------------
WFramePeer.getState() (AWT-EventQueue-0) seems to be trying to enter a critical section,
but this native-level lock is held by the AWT-Windows thread. Unfortunately the AWT-Windows thread is waiting for a java-level lock on a JFrame which is held by AWT-EventQueue-0. So this looks presents itself as a deadlock.