|
PHP Segmentation fault |
Posted by Tobi on Sep-29-2011 07:06 |
|
Hello,
I am a very happy CD user and hope the next version is released soon. Since the last two
years we are doing a lot of graphics and now I discover the first real crash of CD. If you
add a transparent zone/mark to a graph (XY) with transparent background the latest
32bit PHP version crashes with a segmentation fault.
Please, do not ask if it make sense to add transparent zones to a transparent graph I
solved this issue and just do not add transparent zones (is not visible anyway). However,
I just want to report this crash.
Hopefully, you will be able to reproduce the problem and we hope this reports helps! |
Re: PHP Segmentation fault |
Posted by Peter Kwan on Sep-30-2011 01:41 |
|
Hi Tobi,
I have just tried it myself (by adding a transparent zone to the Simple Bar Chart and setting the chart background color to transparent). However, I am unable to reproduce the problem. I tried it on Windows.
I think the problem may only occur on certain OS, or it may only occur in certain chart configuration. If you would like to continue investigating this issue, is it possible to try adding a transparent zone to the "Simple Bar Chart" sample code to see if it can reproduce the problem? If the "Simple Bar Chart" cannot be used to reproduce the problem, is it possible to simplify your existing code to create an example that can reproduce the problem?
Also, please kindly inform me the OS you are using. I may need to test using the same OS.
Regards
Peter Kwan |
Re: PHP Segmentation fault |
Posted by Tobi on Oct-03-2011 07:53 |
|
Hello Peter,
thank you for your reply. I am sorry, I have forget to mention the operating system. It is a debian stable 32-bit version with php 5.3.3-7+squeeze3 The kernel (vserver) is 2.6.32-5-vserver-686-bigmem
Unfortunately, I am way busy right now, so I cannot promise to provide a working example based on the cd samples to reproduce the crashes. Basically, the problem was as follows (pseudo php example):
$chart = new XYChart(200, 80, Transparent);
$chart->setAntiAlias(AntiAlias, NoAntiAlias);
$chart->setTransparentColor(-1);
$plotAreaObj = $chart->setPlotArea(0, 0, 200, 80, Transparent, Transparent, Transparent, Transparent, Transparent);
$chart->setClipping();
$chart->xAxis->setColors(Transparent, Transparent);
$chart->yAxis->setColors(Transparent, Transparent);
// draw three line Layers with addLineLayer2 here
// crashes
$chart->xAxis->addZone(0, 10 0xFFC1D9EE);
// works
$chart->xAxis->addZone(0, 10 0xD0C1D9EE);
You can either remove the addZone call for $color1 or just change the chart background to none-transparent to avoid any crahes, example:
$chart = new XYChart(200, 80, 0x000000);
Since the added zones was transparent (not intended before) and not visible, it makes sense to remove the addzone call and all is working fine. Dimensions of chart was 200x80 with a lot of memory left in PHP.
Hope this Helps,
Tobi |
Re: PHP Segmentation fault |
Posted by Peter Kwan on Oct-04-2011 00:30 |
|
Hi Tobi,
I think I know what could be causing the problem.
The color 0xFFC1D9EE is not really a transparent color. The only fully transparent color is 0xFF000000. All other colors of the form 0xFFnnnnnn are palette colors or dynamic colors used by ChartDirector. You may refer to "Color Specification" in the ChartDirector documentation (you may look for "Color Specification" in the ChartDirector documentation index) for more details.
I suspect in your case, the exact color 0xFFnnnnnn used is interpreted by ChartDirector to mean some undefined palette or dynamic colors, and it eventually causes ChartDirector to crash. (In theory, ChartDirector should verify if a color of the form 0xFFnnnnnn is really a defined color before use, but it is possible the checking has missed some cases.)
So for your case, your code can use totally transparent color, but it must be specified as 0xFF000000, or to use the constant Transparent.
Hope this can help.
Regards
Peter Kwan |
Re: PHP Segmentation fault |
Posted by Tobi on Oct-04-2011 05:15 |
|
Hi Peter,
thank you for your reply, this is much appreciated. While this color might not allowed, it should not lead to a crash. I do not want to refer to a color specification, I do want CD not to crash
We already solved this problem, we do not need any solution for this. However, you might want to check the CD sources to prevent crashes...
Regards
Tobi |
Re: PHP Segmentation fault |
Posted by Peter Kwan on Oct-05-2011 02:35 |
|
Hi Tobi,
I agree that it should not crash. ChartDirector includes code to check for invalid colors, but it is possible it misses some cases. We will do more comprehensive testing to see if we manage to crash the system and fix this problem.
Regards
Max Mak |
|