JDK-6974985 : Jave2Demo threw exceptions when xrender enabled in OEL5.5
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux_redhat_5.0
  • CPU: x86
  • Submitted: 2010-08-05
  • Updated: 2013-05-01
  • Resolved: 2011-03-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b134Fixed
Related Reports
Relates :  
Relates :  
Description
When launch Java2Demo in the linux machine with -Dsun.java2d.xrender=true option, it threw exceptions as below, however the exceptions are not always threw, I tried three times, only the first time it threw this exceptions, file a bug for record to track.

Java Version: 1.7.0-ea-b103
System info: 
host name:jfcsqe-solar.sfbay.sun.com
Linux jfcsqe-solar 2.6.18-194.8.1.0.1.el5 #1 SMP Thu Jul 1 17:09:06 EDT 2010
i686 i686 i386 GNU/Linux
Red Hat Enterprise Linux Server release 5.5 (Tikanga)

How to produce the problem:
1, login to this machine
2, cd /export/jdk/jdk1.7.0 (b103 installed)
3, bin/java -jar -Dsun.java2d.xrender=true demo/jfc/Java2D/*.jar
4, click auto run, it threw exceptions during the run, but not always reproducible.

Exceptions as below:
bin/java -jar -Dsun.java2d.xrender=true demo/jfc/Java2D/*.jar

Java2D Demo RunWindow : 20 Runs, 10 second delay between tabs
java version: 1.7.0-ea
Linux 2.6.18-194.8.1.0.1.el5

#0 Tue Aug 03 16:46:35 PDT 2010, 8055.1406K used
ERROR invokeAndWait : java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
        at java.awt.EventQueue.invokeAndWait(EventQueue.java:1162)
        at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1346)
        at java2d.RunWindow.invokeAndWait(RunWindow.java:321)
        at java2d.RunWindow.run(RunWindow.java:236)
        at java.lang.Thread.run(Thread.java:717)
Caused by: sun.awt.X11.XException: Cannot write XdndAware property
        at sun.awt.X11.XDnDDropTargetProtocol.registerDropTarget(XDnDDropTargetProtocol.java:97)
        at sun.awt.X11.XDropTargetRegistry.registerDropSite(XDropTargetRegistry.java:571)
        at sun.awt.X11.XWindowPeer.addDropTarget(XWindowPeer.java:1902)
        at sun.awt.X11.XComponentPeer.addDropTarget(XComponentPeer.java:1352)
        at java.awt.dnd.DropTarget.addNotify(DropTarget.java:509)
        at java.awt.Component.addNotify(Component.java:6842)
        at java.awt.Container.addNotify(Container.java:2731)
        at javax.swing.JComponent.addNotify(JComponent.java:4741)
        at java.awt.Container.addNotify(Container.java:2742)
        at javax.swing.JComponent.addNotify(JComponent.java:4741)
        at java.awt.Container.addNotify(Container.java:2742)
        at javax.swing.JComponent.addNotify(JComponent.java:4741)
        at java.awt.Container.addNotify(Container.java:2742)
        at javax.swing.JComponent.addNotify(JComponent.java:4741)
        at java.awt.Container.addNotify(Container.java:2742)
        at javax.swing.JComponent.addNotify(JComponent.java:4741)
        at java.awt.Container.addImpl(Container.java:1102)
        at java.awt.Container.add(Container.java:398)
        at java2d.GlobalPanel.stateChanged(GlobalPanel.java:100)
        at javax.swing.JTabbedPane.fireStateChanged(JTabbedPane.java:416)
        at javax.swing.JTabbedPane$ModelListener.stateChanged(JTabbedPane.java:270)
        at javax.swing.DefaultSingleSelectionModel.fireStateChanged(DefaultSingleSelectionModel.java:132)
        at javax.swing.DefaultSingleSelectionModel.setSelectedIndex(DefaultSingleSelectionModel.java:67)
        at javax.swing.JTabbedPane.setSelectedIndexImpl(JTabbedPane.java:616)
        at javax.swing.JTabbedPane.setSelectedIndex(JTabbedPane.java:591)
        at java2d.RunWindow$3.run(RunWindow.java:233)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:241)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:660)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:209)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:118)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
#1 Tue Aug 03 16:48:51 PDT 2010, 7577.7266K used

Comments
EVALUATION The freeing of Pictures was not consistent. XRender freed them automatically on window destroy but not Pixmap destroy. So we need to free pictures associated with a pixmap explicitly, but only once. With this fix in place 2D demo runs very well and whilst there are other unrelated problems (tracked under separate bugs), this appears resolved.
01-03-2011

EVALUATION Java2Demo is notorious for using lots of threads and the registerDropTarget() method will require the toolkit lock. So the only thing I can think of is maybe some code in the Xrender path is failing to grab the toolkit lock. Otherwise it may be a latent problem and Xrender is just more likely to trip over it. Can you please try this say 5 times with xrender and 5 times without xrender and report if it recurs in either case? When you run it please use the option "-ea" as in "java -ea" to enable assertions. That won't tell us if some other thread failed to grab the lock but it will tell us if the thread excecuting registerDropTarget() doesn't have the lock because of an assert present in that method.
05-08-2010