JDK-6841771 : Thread race occur with the test/closed/java/awt/ScrollPane/RemoveChild/ScrollPaneRemoveAdd.html
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: generic
  • Submitted: 2009-05-15
  • Updated: 2011-01-19
  • Resolved: 2009-12-28
Related Reports
Duplicate :  
Relates :  
Description
The test/closed/java/awt/ScrollPane/RemoveChild/ScrollPaneRemoveAdd.html fails sometimes. Appr. once per 5 times.

I'm using JDK7 ~b58 on Fedora9 linux.
Here is the output:
<dav@awt-linux-03(pts/1).372> .../jdk/build/linux-i586/bin/appletviewer ScrollPaneRemoveAdd.html 
java.lang.RuntimeException: ScrollPane doesn't handle correctly add after remove
        at ScrollPaneRemoveAdd.start(ScrollPaneRemoveAdd.java:90)
        at sun.applet.AppletPanel.run(AppletPanel.java:474)
        at java.lang.Thread.run(Thread.java:717

Comments
EVALUATION It looks like the changes for 6834576 don't fix the synchronization problem. The deadlock still occurs in jdk7 b65. The full thread dump attached. The deadlock info is below "AWT-EventQueue-0": at java.awt.Container.getComponentsSync(Container.java:347) - waiting to lock <0xa9e1a370> (a java.awt.Component$AWTTreeLock) at java.awt.Container.paint(Container.java:1823) at java.awt.Window.paint(Window.java:3655) at sun.awt.RepaintArea.paintComponent(RepaintArea.java:264) at sun.awt.X11.XRepaintArea.paintComponent(XRepaintArea.java:73) at sun.awt.RepaintArea.paint(RepaintArea.java:240) at sun.awt.X11.XComponentPeer.handleEvent(XComponentPeer.java:606) at java.awt.Component.dispatchEventImpl(Component.java:4717) at java.awt.Container.dispatchEventImpl(Container.java:2142) at java.awt.Window.dispatchEventImpl(Window.java:2612) at java.awt.Component.dispatchEvent(Component.java:4467) at java.awt.EventQueue.dispatchEvent(EventQueue.java:618) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:286) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:191) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:186) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178) at java.awt.EventDispatchThread.run(EventDispatchThread.java:139) "AppletThread": at sun.misc.Unsafe.park(Native Method) - parking to wait for <0xa9e1a658> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197) at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:214) at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:290) at sun.awt.SunToolkit.awtLock(SunToolkit.java:274) at sun.awt.X11.XToolkit.initializeMultiClickTime(XToolkit.java:1280) at sun.awt.X11.XToolkit.getMultiClickTime(XToolkit.java:1275) at sun.awt.X11.XToolkit.initializeDesktopProperties(XToolkit.java:1449) at java.awt.Toolkit.getDesktopProperty(Toolkit.java:1784) - locked <0xa94e0680> (a sun.awt.X11.XToolkit) at sun.swing.SwingUtilities2$AATextInfo.getAATextInfo(SwingUtilities2.java:133) at javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(MetalLookAndFeel.java:1559) at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:147) at javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1594) at javax.swing.UIManager.setLookAndFeel(UIManager.java:549) at javax.swing.UIManager.setLookAndFeel(UIManager.java:589) at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1345) at javax.swing.UIManager.initialize(UIManager.java:1434) at javax.swing.UIManager.maybeInitialize(UIManager.java:1422) - locked <0xa94e16f0> (a java.lang.Object) at javax.swing.UIManager.getDefaults(UIManager.java:663) at javax.swing.UIManager.getColor(UIManager.java:705) at com.sun.java.swing.plaf.motif.MotifBorders$BevelBorder.<init>(MotifBorders.java:60) at com.sun.java.swing.plaf.motif.MotifLookAndFeel.initComponentDefaults(MotifLookAndFeel.java:209) at sun.awt.X11.XAWTLookAndFeel.initComponentDefaults(XAWTLookAndFeel.java:86) at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:147) at sun.awt.X11.XToolkit.initUIDefaults(XToolkit.java:259) at sun.awt.X11.XToolkit.getUIDefaults(XToolkit.java:239) at sun.awt.X11.XScrollPanePeer.<clinit>(XScrollPanePeer.java:47) at sun.awt.X11.XToolkit.createScrollPane(XToolkit.java:999) at java.awt.ScrollPane.addNotify(ScrollPane.java:560) - locked <0xa9e1a370> (a java.awt.Component$AWTTreeLock) at java.awt.Container.addImpl(Container.java:1086) - locked <0xa9e1a370> (a java.awt.Component$AWTTreeLock) at java.awt.Container.add(Container.java:399) at ScrollPaneRemoveAdd.init(ScrollPaneRemoveAdd.java:49) at com.sun.javatest.regtest.AppletWrapper$AppletThread.run(AppletWrapper.java:144) at java.lang.Thread.run(Thread.java:717) "AWT-XAWT": at sun.awt.X11.XToolkit.getNumberOfButtonsImpl(Native Method) - waiting to lock <0xa94e0680> (a sun.awt.X11.XToolkit) at sun.awt.X11.XToolkit.getNumberOfButtons(XToolkit.java:1469) at java.awt.event.MouseEvent.<clinit>(MouseEvent.java:396) at sun.awt.X11.XWindow.handleXCrossingEvent(XWindow.java:987) at sun.awt.X11.XBaseWindow.dispatchEvent(XBaseWindow.java:1114) at sun.awt.X11.XBaseWindow.dispatchToWindow(XBaseWindow.java:1074) at sun.awt.X11.XToolkit.dispatchEvent(XToolkit.java:543) at sun.awt.X11.XToolkit.run(XToolkit.java:652) at sun.awt.X11.XToolkit.run(XToolkit.java:573) at java.lang.Thread.run(Thread.java:717)
23-07-2009

EVALUATION This test fails on my computer as well. It's a deadlock and the stack trace of the deadlock is the same as the stack trace of 6834576. We need to make sure that the test will not fail on jdk7 b60, this build will include the patch for 6834576.
01-06-2009