php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28084 Crashes when fonts are accessed
Submitted: 2004-04-21 00:44 UTC Modified: 2004-05-11 15:36 UTC
Votes:4
Avg. Score:4.5 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:3 (100.0%)
From: doormat at sequence-omega dot net Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 4.3.6 OS: Windows 2000 SP3
Private report: No CVE-ID: None
 [2004-04-21 00:44 UTC] doormat at sequence-omega dot net
Description:
------------
Using the JPGraph library, when any graphs are created at the same time, and they use TrueType fonts, apache will crash. Switching away from the use of TrueType fonts helps, but occasional crashes still happen. The developer of JPGraph said the problem was in the underlying PHP implementation (http://jpgraph.fan-atics.com/viewtopic.php?t=1752) so I'd thought I'd file a bug report to see if ya'll could figure it out. 

Reproduce code:
---------------
Too long to post... download sample code from http://www.aditus.nu/jpgraph/ and put multiple graphs (especially ones that use TTFs) on one page and load it up and apache should crash. 


Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-21 09:12 UTC] derick@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

 [2004-04-21 09:12 UTC] derick@php.net
Also, which webserver do you use? And if you want us to debug this, provide a short (max 10 lines!) reproducing script (or get the JPGraph author to do this).
 [2004-04-21 18:24 UTC] doormat at sequence-omega dot net
I'm using Apache 1.3.29. I'm not quite sure how to show that  it crashes in 10 lines or less, especially since the problem only seems to happen when multiple images are being generated at the same moment (a page is requested with multiple images, many images are generated with php/GD, if the page has a bunch of graphs, apache typically crashes). I'll work on it and get back to you though.
 [2004-04-25 18:21 UTC] iliaa@php.net
Please make a script (as short as possible) that can be 
used to consistently replicate the crash. 
 [2004-05-04 07:28 UTC] dietrich dot ayala at foundstone dot com
i'm getting this also. it's reproducible 100% of the time. also using jpGraph.

i'm working on getting this isolated, but as jpGraph is many thousands of lines long, it's difficult.

i'm using IIS/WinXP&2k/PHP-4.3.6 & 4.3.7-dev.
 [2004-05-04 07:32 UTC] dietrich dot ayala at foundstone dot com
sorry, i left a piece of information out: php.exe is crashing for me, not the webserver. that's the only behavioral difference between what i'm experiencing from the original bug report.

every time i load my graph scripts, php.exe goes boom.
 [2004-05-04 07:49 UTC] dietrich dot ayala at foundstone dot com
another comment: this is a regression. our code works fine in 4.3.2, but is broken b/c of this so we cannot upgrade.

here's a quote from the jpgraph people:

"There seems to be a bug with some versions of PHP on Windows. It has a (known) problem with simultaneous accessing the TTF libraries, (perhaps some thread-safety issues ?). No known workaround exists (apart from moving away from Win2000) as far as I'm aware."

is anyone familiar w/ this issue?

thanks, d.
 [2004-05-04 21:40 UTC] dietrich dot ayala at foundstone dot com
here is a simple reproduction script.

the crash only occurs when writing the image to file, and is reproducible 100% of the time.

<?php

$string = "i crash.";
$font  = 4;
$width  = ImageFontWidth($font) * strlen($string);
$height = ImageFontHeight($font);
          
$im = @imagecreate ($width,$height);

$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 0, 0,0);

imagestring($im, $font, 0, 0,  $string, $text_color);
imagejpeg($im,'test_sample.jpg');
?>
 [2004-05-04 22:38 UTC] jpgraph at aditus dot nu
The following code is said to repeat the crash on Win32 , works fine on Linux. Unfortunately I don't have access to a Win32 system to be able to repeat.

The reproduce script was submitted by dietrich at ganx4 com

<?php 

$string = "i crash."; 
$font = 4; 
$width = ImageFontWidth($font) * strlen($string); 
$height = ImageFontHeight($font); 

$im = @imagecreate ($width,$height); 

$background_color = imagecolorallocate($im, 255, 255, 255); 
$text_color = imagecolorallocate($im, 0, 0,0); 

imagestring($im, $font, 0, 0, $string, $text_color); 
imagejpeg($im,'test_sample.jpg'); 
?>
 [2004-05-05 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2004-05-05 01:08 UTC] wez@php.net
err, I meant open.
 [2004-05-06 16:59 UTC] mmoria01 at sprintspectrum dot com
This happens to me as well. What is odd in my case is when my webpage (intranet site) has been idle for more than a few hours (like overnight), the next graph generation session will come back with one of the graphs throwing a JPGraph "TTF Font Error". On the monitor of the server box there will be a "Message Box" stating that Apache has crashed and a log file has been created. I hit "OK" but never have to restart Apache and all is fine. Even while this "Message Box" is present, the server will still generate pages with graphs. I've looked all over for this log file it said it created and have never found one. I resubmit the request and all graphs are fine. Everything works flawlessly as long as the server is kept fairly active.

Apache 1.3.24
PHP 4.3.3 as a SAPI module
Windows 2000 SP3

HTH

-matt
 [2004-05-09 23:28 UTC] dietrich dot ayala at foundstone dot com
I compiled the GD2 module against the most recent stable versions of freetype, libpng, libjpeg and zlib, and this problem went away.
 [2004-05-11 15:36 UTC] iliaa@php.net
Was a problem wiht underlying libraries. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Aug 14 11:01:29 2024 UTC