Pie Chart Crashes Java VM

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

Pie Chart Crashes Java VM

Postby Fran Tonello » Wed Mar 12, 2003 7:27 pm

In JFreeChart 0.9.6 Pie charts, I've discovered that attempting to plot a value less than .01 will crash the Java virtual machine. I'm using a DefaultPieDataset. The crash is so catastrophic that the VM doesn't even dump a stack trace on my Solaris machine. This problem also occurs on Windows and Mac (yes, 1.4.1 is out for Mac OS X!). I discovered the .01 limit heuristically; the actual problem value may be slightly different.

Fortunately, there's an easy workaround. Before the call to setValue(), simply test it for being less than .01 and if so, set the value to zero.
Fran Tonello

Re: Pie Chart Crashes Java VM

Postby David Gilbert » Thu Mar 13, 2003 5:48 pm

I couldn't reproduce the problem. Can you supply a small demo app that fails for you?


Dave Gilbert
David Gilbert

Postby Guest » Fri Mar 14, 2003 7:52 pm

Hi Dave,

I'll send you a sample as soon as I can. Meanwhile, we've noticed that even with my workaround, the Mac OS X JVM consistently crashes when switching between GUI JPanels that contain JFreeCharts. I suspect that these problems are related. There are also two problems here as I see it; yes, something JFreeChart is doing isn't kosher, but there's also something wrong in some common JVM code that fails to catch the problem. (The VM should never crash.) Supporting this conclusion is the fact that the VM dies in a C++ module in a 'share' directory.

For what it's worth, here's the info the Mac VM spits out when it croaks:

# HotSpot Virtual Machine Error, Internal Error
# Please report this error at
# http://bugreport.apple.com/
# Java VM: Java HotSpot(TM) Client VM (1.4.1_01-14 mixed mode)
# ShouldNotReachHere()
# Error ID: /SourceCache/HotSpot14/HotSpot14-14/src/share/vm/c1/c1_RInfo.cpp, 103
# Problematic Thread: prio=5 tid=0x00096810 nid=0x5a550 runnable

JVM crash on pie3D chart rendering

Postby Gang » Sun Mar 16, 2003 11:54 pm

The crash seems data related. For certain small data values, both pie3D and pie chart types crash on Solaris macines, while it works fine on Win2k. I am using JDK 1.4.1 and JFreeChart 9.4 with cewolf 0.7.2.

I saw two posts on this but offered no solution:

http://page.inf.fu-berlin.de/~cyganiak/ ... derer.html

http://sourceforge.net/tracker/index.ph ... tid=115494

Postby david.gilbert » Mon Mar 17, 2003 10:06 am

Any further information that anyone can supply on this would be helpful. I'd like to squash this bug...


Dave Gilbert
JFreeChart Project Leader
Posts: 11664
Joined: Fri Mar 14, 2003 10:29 am

Postby Fran Tonello » Tue Mar 18, 2003 12:01 am

I just saw this happen again on Solaris even with my ".01" workaround in place. In other words, the problem occurred with a value greater than .01. This was in the 1.4.0 JVM.

A thought: could the problem be set up after a pie chart has plotted any value less than one? -Dividing by any value less than one is actually multiplying...
Fran Tonello

Postby Fran Tonello » Tue Mar 18, 2003 12:11 am

I can also confirm Gang's observation that this problem does NOT occur on Windows. I just double-checked this with our QA folks. Sorry about the confusion.

We have observed the problem on Solaris and Mac OS X. We are trying to ascertain whether the problem also occurs on Linux.
Fran Tonello

Postby david.gilbert » Tue Mar 18, 2003 12:17 am

I have reproduced the bug using PieChartDemo1 with the dataset changed to:
Code: Select all
// create a dataset...
DefaultPieDataset data = new DefaultPieDataset();
data.setValue("One", new Double(0.0000001));
data.setValue("Two", new Double(10.0));
data.setValue("Three", new Double(27.5));
data.setValue("Four", new Double(17.5));
data.setValue("Five", new Double(11.0));
data.setValue("Six", new Double(19.4));

The error logged is:
Code: Select all
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x49de9222
Function name=(N/A)

NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.

Current Java thread:
   at sun.dc.pr.PathFiller.setOutputArea(Native Method)
   at sun.dc.pr.Rasterizer.setOutputArea(Rasterizer.java:630)
   at sun.java2d.pipe.DuctusShapeRenderer.renderPath(DuctusShapeRenderer.java:72)
   at sun.java2d.pipe.DuctusShapeRenderer.draw(DuctusShapeRenderer.java:43)
   at sun.java2d.SunGraphics2D.draw(SunGraphics2D.java:1594)
   at com.jrefinery.chart.plot.PiePlot.drawPie(PiePlot.java:1389)
   at com.jrefinery.chart.plot.PiePlot.draw(PiePlot.java:1241)
   at com.jrefinery.chart.JFreeChart.draw(JFreeChart.java:685)
   at com.jrefinery.chart.ChartPanel.paintComponent(ChartPanel.java:857)
   at javax.swing.JComponent.paint(JComponent.java:682)
   at javax.swing.JComponent.paintChildren(JComponent.java:493)
   at javax.swing.JComponent.paint(JComponent.java:691)
   at javax.swing.JLayeredPane.paint(JLayeredPane.java:541)
   at javax.swing.JComponent.paintChildren(JComponent.java:493)
   at javax.swing.JComponent.paint(JComponent.java:664)
   at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:18)
   at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:49)
   at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:86)
   at java.awt.Container.paint(Container.java:955)
   at sun.awt.RepaintArea.paint(RepaintArea.java:293)
   at sun.awt.motif.MComponentPeer.handleEvent(MComponentPeer.java:344)
   at java.awt.Component.dispatchEventImpl(Component.java:2658)
   at java.awt.Container.dispatchEventImpl(Container.java:1208)
   at java.awt.Window.dispatchEventImpl(Window.java:923)
   at java.awt.Component.dispatchEvent(Component.java:2492)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:334)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:126)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:93)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:88)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:80)

Dynamic libraries:
08048000-0804c000 r-xp 00000000 03:06 621583     /usr/lib/SunJava2-1.3.1/bin/i386/native_threads/java
0804c000-0804d000 rw-p 00003000 03:06 621583     /usr/lib/SunJava2-1.3.1/bin/i386/native_threads/java
40000000-40012000 r-xp 00000000 03:06 391960     /lib/ld-2.2.5.so
40012000-40013000 rw-p 00011000 03:06 391960     /lib/ld-2.2.5.so
40014000-40025000 r-xp 00000000 03:06 571270     /usr/lib/SunJava2-1.3.1/jre/lib/i386/libverify.so
40025000-40027000 rw-p 00010000 03:06 571270     /usr/lib/SunJava2-1.3.1/jre/lib/i386/libverify.so
40027000-40028000 r--p 00000000 03:06 718291     /usr/lib/locale/en_GB/LC_IDENTIFICATION
40028000-40029000 r--p 00000000 03:06 279133     /usr/lib/locale/en_GB/LC_MEASUREMENT
40029000-4002a000 r--p 00000000 03:06 718292     /usr/lib/locale/en_GB/LC_TELEPHONE
4002a000-4002b000 r--p 00000000 03:06 393384     /usr/lib/locale/en_GB/LC_ADDRESS
4002b000-4002c000 r--p 00000000 03:06 393388     /usr/lib/locale/en_GB/LC_NAME
4002c000-4003a000 r-xp 00000000 03:06 391286     /lib/libpthread.so.0
4003a000-40041000 rw-p 0000e000 03:06 391286     /lib/libpthread.so.0
40041000-4004a000 r-xp 00000000 03:06 69395      /usr/lib/SunJava2-1.3.1/jre/lib/i386/native_threads/libhpi.so
4004a000-4004b000 rw-p 00008000 03:06 69395      /usr/lib/SunJava2-1.3.1/jre/lib/i386/native_threads/libhpi.so
4004b000-40250000 r-xp 00000000 03:06 196092     /usr/lib/SunJava2-1.3.1/jre/lib/i386/client/libjvm.so
40250000-40351000 rw-p 00204000 03:06 196092     /usr/lib/SunJava2-1.3.1/jre/lib/i386/client/libjvm.so
40368000-4036a000 r-xp 00000000 03:06 391274     /lib/libdl.so.2
4036a000-4036b000 rw-p 00001000 03:06 391274     /lib/libdl.so.2
4036c000-40480000 r-xp 00000000 03:06 391270     /lib/libc.so.6
40480000-40486000 rw-p 00113000 03:06 391270     /lib/libc.so.6
4048a000-4049c000 r-xp 00000000 03:06 391277     /lib/libnsl.so.1
4049c000-4049d000 rw-p 00011000 03:06 391277     /lib/libnsl.so.1
4049f000-404c1000 r-xp 00000000 03:06 391275     /lib/libm.so.6
404c1000-404c2000 rw-p 00021000 03:06 391275     /lib/libm.so.6
404c2000-404fb000 r-xp 00000000 03:06 586448     /usr/lib/libstdc++-libc6.1-1.so.2
404fb000-40507000 rw-p 00038000 03:06 586448     /usr/lib/libstdc++-libc6.1-1.so.2
4050a000-4052b000 r-xp 00000000 03:06 571197     /usr/lib/SunJava2-1.3.1/jre/lib/i386/libjava.so
4052b000-4052d000 rw-p 00020000 03:06 571197     /usr/lib/SunJava2-1.3.1/jre/lib/i386/libjava.so
4052e000-40542000 r-xp 00000000 03:06 571644     /usr/lib/SunJava2-1.3.1/jre/lib/i386/libzip.so
40542000-40545000 rw-p 00013000 03:06 571644     /usr/lib/SunJava2-1.3.1/jre/lib/i386/libzip.so
40545000-4127b000 r--s 00000000 03:06 229167     /usr/lib/SunJava2-1.3.1/jre/lib/rt.jar
412a8000-4159f000 r--s 00000000 03:06 229151     /usr/lib/SunJava2-1.3.1/jre/lib/i18n.jar
4159f000-415b5000 r--s 00000000 03:06 229168     /usr/lib/SunJava2-1.3.1/jre/lib/sunrsasign.jar
4365d000-4365e000 r--p 00000000 03:06 279529     /usr/lib/locale/en_GB/LC_PAPER
4365e000-4365f000 r--p 00000000 03:06 684238     /usr/lib/locale/en_GB/LC_MESSAGES/SYS_LC_MESSAGES
4365f000-43660000 r--p 00000000 03:06 749258     /usr/lib/locale/en_GB/LC_MONETARY
496bf000-496ea000 r--p 00000000 03:06 197450     /usr/lib/locale/en_GB/LC_CTYPE
496ea000-496f0000 r--p 00000000 03:06 279089     /usr/lib/locale/en_GB/LC_COLLATE
496f0000-496f1000 r--p 00000000 03:06 635361     /usr/lib/locale/en_GB/LC_TIME
496f1000-496f2000 r--p 00000000 03:06 197454     /usr/lib/locale/en_GB/LC_NUMERIC
4975e000-49b2c000 r-xp 00000000 03:06 571183     /usr/lib/SunJava2-1.3.1/jre/lib/i386/libawt.so
49b2c000-49b3c000 rw-p 003cd000 03:06 571183     /usr/lib/SunJava2-1.3.1/jre/lib/i386/libawt.so
49b51000-49b82000 r-xp 00000000 03:06 571203     /usr/lib/SunJava2-1.3.1/jre/lib/i386/libmlib_image.so
49b82000-49b84000 rw-p 00030000 03:06 571203     /usr/lib/SunJava2-1.3.1/jre/lib/i386/libmlib_image.so
49b84000-49b85000 r--p 00000000 03:06 374794     /usr/share/locale/en_GB/LC_MESSAGES/libc.mo
49b85000-49b8a000 r--s 00000000 03:06 49079      /usr/lib/gconv/gconv-modules.cache
49b8a000-49b8c000 r-xp 00000000 03:06 49033      /usr/lib/gconv/ISO8859-1.so
49b8c000-49b8d000 rw-p 00001000 03:06 49033      /usr/lib/gconv/ISO8859-1.so
49b8d000-49b8f000 r-xp 00000000 03:06 1455       /usr/X11R6/lib/X11/locale/lib/common/xlcDef.so.2
49b8f000-49b90000 rw-p 00001000 03:06 1455       /usr/X11R6/lib/X11/locale/lib/common/xlcDef.so.2
49b9c000-49ba3000 r-xp 00000000 03:06 82886      /usr/X11R6/lib/libXp.so.6.2
49ba3000-49ba4000 rw-p 00006000 03:06 82886      /usr/X11R6/lib/libXp.so.6.2
49ba4000-49bf2000 r-xp 00000000 03:06 82892      /usr/X11R6/lib/libXt.so.6.0
49bf2000-49bf6000 rw-p 0004d000 03:06 82892      /usr/X11R6/lib/libXt.so.6.0
49bf6000-49c03000 r-xp 00000000 03:06 82874      /usr/X11R6/lib/libXext.so.6.4
49c03000-49c04000 rw-p 0000c000 03:06 82874      /usr/X11R6/lib/libXext.so.6.4
49c04000-49c08000 r-xp 00000000 03:06 82894      /usr/X11R6/lib/libXtst.so.6.1
49c08000-49c09000 rw-p 00004000 03:06 82894      /usr/X11R6/lib/libXtst.so.6.1
49c09000-49cfd000 r-xp 00000000 03:06 82864      /usr/X11R6/lib/libX11.so.6.2
49cfd000-49d01000 rw-p 000f4000 03:06 82864      /usr/X11R6/lib/libX11.so.6.2
49d01000-49d09000 r-xp 00000000 03:06 82862      /usr/X11R6/lib/libSM.so.6.0
49d09000-49d0a000 rw-p 00007000 03:06 82862      /usr/X11R6/lib/libSM.so.6.0
49d0a000-49d1e000 r-xp 00000000 03:06 81832      /usr/X11R6/lib/libICE.so.6.3
49d1e000-49d1f000 rw-p 00013000 03:06 81832      /usr/X11R6/lib/libICE.so.6.3
49d21000-49dac000 r-xp 00000000 03:06 571187     /usr/lib/SunJava2-1.3.1/jre/lib/i386/libfontmanager.so
49dac000-49dbc000 rw-p 0008a000 03:06 571187     /usr/lib/SunJava2-1.3.1/jre/lib/i386/libfontmanager.so
49dbc000-49dd8000 r-xp 00000000 03:06 1454       /usr/X11R6/lib/X11/locale/lib/common/ximcp.so.2
49dd8000-49dda000 rw-p 0001b000 03:06 1454       /usr/X11R6/lib/X11/locale/lib/common/ximcp.so.2
49dda000-49df6000 r-xp 00000000 03:06 571186     /usr/lib/SunJava2-1.3.1/jre/lib/i386/libdcpr.so
49df6000-49e0a000 rw-p 0001b000 03:06 571186     /usr/lib/SunJava2-1.3.1/jre/lib/i386/libdcpr.so

Local Time = Mon Mar 17 22:35:26 2003
Elapsed Time = 2
# The exception above was detected in native code outside the VM
# Java VM: Java HotSpot(TM) Client VM (1.3.1_04-b02 mixed mode)

This bug on Sun's Java site is the same issue, as far as I can tell:


In JFreeChart, the bug is triggered by drawing an arc with a very small angle. Based on the values that JFreeChart is using, I've put together the following small application that crashes the JVM:
Code: Select all
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.Arc2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.util.Date;

public class CrashVM {

    public static void main(String[] args) {
        BufferedImage image = new BufferedImage(400, 300, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = (Graphics2D) image.getGraphics();
        Rectangle2D bounds = new Rectangle2D.Double(168.83125, 54.60624999999999, 162.33749999999998, 162.33749999999998);
        Arc2D arc = new Arc2D.Double(bounds, 90.0, -4.2154566415320005E-7, Arc2D.PIE);
        System.out.println("About to draw...");
        System.out.println("Done --> " + new Date().toString());


If you comment out the anti-alias setting, the code runs to completion.

What I will try to do is work out if there is some threshold angle below which the problem occurs and above which it doesn't. If that is the case, I can base a workaround on the pie section angle (rather than the data value).


Dave Gilbert
JFreeChart Project Leader
Posts: 11664
Joined: Fri Mar 14, 2003 10:29 am

Postby david.gilbert » Tue Mar 18, 2003 12:19 am

I should have stated that I am running Java 1.3.1 on SuSE Linux.


Dave Gilbert
JFreeChart Project Leader
Posts: 11664
Joined: Fri Mar 14, 2003 10:29 am

Postby Fran Tonello » Tue Mar 18, 2003 7:15 pm

That's excellent work, Dave! It also explains why my simple-minded ".01" workaround doesn't always work. -Depending on the values of the other pie slices, the arc that's attempted to be drawn may or may not be small enough to trigger the JVM bug. Hopefully, it'll be easy for JFreeChart to work around.
Fran Tonello

Postby Fran Tonello » Thu Mar 20, 2003 7:54 pm

Hi Dave,

I'm just curious as to whether you have an idea of when your workaround will be available?

Also, please feel free to send me a beta. We can also test it in our Macs here and let you know if the workaround helps them, too.

Fran Tonello
Posts: 8
Joined: Thu Mar 20, 2003 7:45 pm

Postby david.gilbert » Fri Mar 21, 2003 1:07 pm

Hi Fran,

I have a fix that works for me, I'll check the code into CVS shortly. If you can test it out for your configuration, that would be excellent.


Dave Gilbert
JFreeChart Project Leader
Posts: 11664
Joined: Fri Mar 14, 2003 10:29 am

Postby david.gilbert » Fri Mar 21, 2003 1:45 pm

OK, CVS is done now.


Dave Gilbert
JFreeChart Project Leader
Posts: 11664
Joined: Fri Mar 14, 2003 10:29 am

Postby david.gilbert » Thu Mar 27, 2003 12:26 am

BACKGROUND: I added some details to an existing bug in the Java bug database:


UPDATE: Today, I received an e-mail from a Sun engineer saying he had opened a new bug report, since this might not be the same issue as 4617206. The new report is:


Sun have been able to reproduce the problem and were confident of being able to fix it for a future release of JDK 1.3.1 and JDK 1.4.1.


Dave Gilbert
JFreeChart Project Leader
Posts: 11664
Joined: Fri Mar 14, 2003 10:29 am

Any workaround without JFreeChart update

Postby Gang » Mon Apr 14, 2003 10:26 pm

Since I am using Cewolf that bundled with JFreeChart, it will take a while
for me to pick up the latest JFreeChart release. Since the 0.01 threshold
seems not working for all cases, can you give me a similar workaround on
the data part to prevent the crash, without waiting for the JFreeChart
upgrade. Thanks.


Return to JFreeChart

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Majestic-12 [Bot] and 4 guests