JFreeChart, RedHat 7.2, and jdk 1.3.1_01

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Shawn Ellis

JFreeChart, RedHat 7.2, and jdk 1.3.1_01

Post by Shawn Ellis » Thu Nov 29, 2001 12:08 am

With RedHat 7.2 I've noticed some kind of deadlock condition with jdk 1.3.1_01 and JFreeChart. This includes version 0.6.0 and the previous version. What I see is that the load average of the RedHat box will go up to around 1 and no chart is displayed on the screen. Here is how to reproduce the problem.

1. Install RedHat 7.2 (I'm using XFree86 4.1.0-3)
2. Install jdk1.3.1_01
3. Run java -cp jfreechart-0.6.0.jar:jars/jcommon-0.5.1.jar com.jrefinery.chart.demo.JFreeChartDemo
4. Click on a chart that you want created.
5. A new window will pop up and everything will deadlock

For some reason, if I use jdk1.4 beta3, I don't see this problem at all. Just wondering if you have seen this behaviour before. I can reproduce it on two separate boxes.

Here is a thread dump of what I'm seeing.

Full thread dump:

"Thread-0" prio=1 tid=0x804e0b0 nid=0x22ad waiting on monitor [0..0xbfffd5a8]

"Screen Updater" prio=1 tid=0x81c88b0 nid=0x22d3 waiting on monitor [0x4b46d000..0x4b46d870]
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:420)
at sun.awt.ScreenUpdater.nextEntry(ScreenUpdater.java:76)
at sun.awt.ScreenUpdater.run(ScreenUpdater.java:95)

"AWT-Motif" prio=1 tid=0x816f730 nid=0x22d2 runnable [0x4b26d000..0x4b26d870]
at sun.awt.motif.MToolkit.run(Native Method)
at java.lang.Thread.run(Thread.java:484)

"SunToolkit.PostEventQueue-0" prio=1 tid=0x815fb08 nid=0x22d1 waiting on monitor [0x4b06d000..0x4b06d870]
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:420)
at sun.awt.PostEventQueue.run(SunToolkit.java:491)

"AWT-EventQueue-0" prio=1 tid=0x815c260 nid=0x22d0 runnable [0x4ae6c000..0x4ae6d870]
at sun.awt.font.NativeFontWrapper.layoutGlyphVector(Native Method)
at sun.awt.font.StandardGlyphVector.performDefaultLayout(StandardGlyphVector.java:212)
at sun.awt.font.StandardGlyphVector.initPositions(StandardGlyphVector.java:427)
at sun.awt.font.StandardGlyphVector.getLogicalBounds(StandardGlyphVector.java:324)
at java.awt.Font.getStringBounds(Font.java:1506)
at java.awt.Font.getStringBounds(Font.java:1429)
at java.awt.FontMetrics.getStringBounds(FontMetrics.java:461)
at com.jrefinery.chart.StandardLegend.createLegendItem(Unknown Source)
at com.jrefinery.chart.StandardLegend.draw(Unknown Source)
at com.jrefinery.chart.StandardLegend.draw(Unknown Source)
at com.jrefinery.chart.JFreeChart.draw(Unknown Source)
at com.jrefinery.chart.JFreeChartPanel.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(JComponent.java:687)
at javax.swing.JComponent.paintChildren(JComponent.java:498)
at javax.swing.JComponent.paint(JComponent.java:696)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:546)
at javax.swing.JComponent.paintChildren(JComponent.java:498)
at javax.swing.JComponent.paint(JComponent.java:669)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:23) at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:54)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:91)
at java.awt.Container.paint(Container.java:960)
at sun.awt.RepaintArea.paint(RepaintArea.java:298)
at sun.awt.motif.MComponentPeer.handleEvent(MComponentPeer.java:349)
at java.awt.Component.dispatchEventImpl(Component.java:2663)
at java.awt.Container.dispatchEventImpl(Container.java:1213)
at java.awt.Window.dispatchEventImpl(Window.java:926)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)

"Signal Dispatcher" daemon prio=1 tid=0x8096a78 nid=0x22ce waiting on monitor [0..0]

"Finalizer" daemon prio=1 tid=0x808e8b8 nid=0x22cb waiting on monitor [0x49c6e000..0x49c6e870]
at java.lang.Object.wait(Native Method)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:108)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:123)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:162)

"Reference Handler" daemon prio=1 tid=0x808dcf8 nid=0x22ca waiting on monitor [0x49a6e000..0x49a6e870]
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:420)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:110)

"VM Thread" prio=1 tid=0x808ac20 nid=0x22c9 runnable

"VM Periodic Task Thread" prio=1 tid=0x80956d8 nid=0x22cc waiting on monitor
"Suspend Checker Thread" prio=1 tid=0x80960a8 nid=0x22cd runnable

David Gilbert

RE: JFreeChart, RedHat 7.2, and jdk 1.3.1_01

Post by David Gilbert » Thu Nov 29, 2001 9:44 am

Hi Shawn,

Thanks for reporting this - I wasn't aware of it.

I'm developing on SuSE 7.3 and I use the JDK that ships with JBuilder 5 (1.3.1_02 I think). The only problem I notice is the label on the vertical axis is offset to the right more than it should be, and I think this is a bug in the JDK. Not quite as serious as what you are seeing!

I guess it is probably a bug in the JDK you are using, but if you find out more please let me know. Especially if there is a workaround that I can put into JFreeChart...

Regards,

DG

Andrzej Nagórko

RE: JFreeChart, RedHat 7.2, and jdk 1.3.1_01

Post by Andrzej Nagórko » Sat Jan 12, 2002 12:47 pm

Hello,

I ran into similar problem. It happened on Debian Linux with java 1.3.1_01 but upgrade to 1.3.1_02 didn't help.

After some printf-debugging I found that problem was that LineMetrics.getHeight() returned seemingly random values. Sometimes it resulted in infinite loop in StandardLegend.draw method (when getHeight in createLegendItem returned value greater than 31000) sometimes in wrong layout of graph (I've put example at http://xocrates.pl/error.gif). It is probably bug in my Debian configuration, since I didn't find any relevant bug in java bug database. Maybe I installed ttf fonts wrong - but on other hand everything else works fine?

My workaround was to change default fonts from "SansSerif" to "Lucida Sans", as only fonts I found in jre/lib/fonts directory were Lucida fonts. My guess was that java will work correctly with its own fonts and fortunately it does.

Hopefully this helps,
Andrzej

Locked