JDK-6756195 : Deadlock in X11GraphicsConfig between AWT-EventQueue and AWT-Motif threads
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0u16
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: solaris_1
  • CPU: x86
  • Submitted: 2008-10-06
  • Updated: 2012-01-16
Related Reports
Relates :  
Description
Originally reported in NetBeans bug tracking system:
http://www.netbeans.org/issues/show_bug.cgi?id=148868

One of NetBeans users running on Open Solaris x86 with JDK 1.5.0_16 reports that from time to time, following deadlock in X11GraphicsConfig occurs:

Found one Java-level deadlock:
=============================
"AWT-EventQueue-1":
  waiting to lock monitor 0x0811ec54 (object 0xd6eeaa80, a java.lang.Class)
  in JNI, which is held by "AWT-Motif"
"AWT-Motif":
  waiting to lock monitor 0x0811ef14 (object 0xadd93360, a sun.awt.X11GraphicsConfig),
  which is held by "AWT-EventQueue-1"

Java stack information for the threads listed above:
===================================================
"AWT-EventQueue-1":
        at sun.awt.X11GraphicsConfig.makeColorModel(Native Method)
        at sun.awt.X11GraphicsConfig.getColorModel(X11GraphicsConfig.java:249)
        - locked <0xadd93360> (a sun.awt.X11GraphicsConfig)
        at sun.awt.motif.X11VolatileSurfaceManager.initAcceleratedSurface(X11VolatileSurfaceManager.java:67)
        at sun.awt.image.VolatileSurfaceManager.initialize(VolatileSurfaceManager.java:85)
        at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:58)
        at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:67)
        at sun.awt.image.SunVolatileImage.<init>(SunVolatileImage.java:85)
        at sun.awt.X11GraphicsConfig.createCompatibleVolatileImage(X11GraphicsConfig.java:195)
        at javax.swing.RepaintManager.getVolatileOffscreenBuffer(RepaintManager.java:597)
        at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4911)
        at javax.swing.JComponent.paint(JComponent.java:996)
        at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
        at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
        at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
        at java.awt.Container.paint(Container.java:1709)
        at org.netbeans.core.windows.view.ui.MainWindow.paint(MainWindow.java:577)
        at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
        at sun.awt.RepaintArea.paint(RepaintArea.java:224)
        at sun.awt.motif.MComponentPeer.handleEvent(MComponentPeer.java:395)
        at java.awt.Component.dispatchEventImpl(Component.java:4060)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Window.dispatchEventImpl(Window.java:1791)
        at java.awt.Component.dispatchEvent(Component.java:3819)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
"AWT-Motif":
        at sun.awt.X11GraphicsConfig.getSurfaceType(X11GraphicsConfig.java:143)
        - waiting to lock <0xadd93360> (a sun.awt.X11GraphicsConfig)
        at sun.awt.X11SurfaceData.createData(X11SurfaceData.java:322)
        at sun.awt.X11GraphicsConfig.createSurfaceData(X11GraphicsConfig.java:380)
        at sun.awt.motif.MComponentPeer.validateSurface(MComponentPeer.java:912)
        at sun.awt.motif.MWindowPeer.handleResize(MWindowPeer.java:220)
        at sun.awt.motif.MToolkit.run(Native Method)
        at java.lang.Thread.run(Thread.java:595)

Found 1 deadlock.
------------------------

Problem is hard to reproduce, as usual in threading issues. Full thread dump is in attachment.

Comments
EVALUATION This problem is independent on whether MToolkit or XToolkit is used, at least I see similar reports when running with XToolkit, for example, 6529933. In the evaluation for this CR there is a statement about using synchronized methods in X11GraphicsConfig class: this is a known source of deadlocks and other problems. All the bugs from this area are handled by Java2D team, so java/java/classes_2d looks like a right place for this CR.
13-10-2008

EVALUATION Motif is involved. Transfering to AWT team for initial evaluation.
13-10-2008