From: baco at infomaniak dot ch
Operating system: Linux
PHP version: 4.4.7
PHP Bug Type: GD related
Bug description: Apache2 locked imagecreate with imagettftext
Description:
------------
Reproductible with PHP 4.4.7
or with the last Snap 4.4-dev
on Apache2 using MPM worker.
Apache2 process get locked when calling
imagettftext() after calling imagecreate()
every call of such code result of another
dead locked Apache2 processes.
Workarounds :
- Use imagecreatetruecolor() instead of imagecreate()
- Don't use bundled gdlib compile PHP with external gdlib
- Upgrade 5.2.3 who don't have this issue
Reproductible with
configure \
--with-gd \
--with-png-dir=/usr \
--with-freetype-dir=/usr \
--with-ttf \
--enable-gd-native-ttf \
...
Unreproductible with external gd
configure \
--with-gd=/opt/misc/gd \
--with-png-dir=/usr \
--with-jpeg-dir=/usr \
--with-freetype-dir=/usr \
--with-ttf \
--enable-gd-native-ttf \
...
Reproduce code:
---------------
$crash = 1;
$text = 'Bug';
$font = $_SERVER['DOCUMENT_ROOT'] . '/fonts' .'/'. 'arial.ttf';
if ($crash == 1) {
$image = imagecreate(64, 32);
} else {
$image = imagecreatetruecolor(64, 32);
}
$white = imagecolorallocate($image, 255, 255, 255);
/* LOCK APACHE2 PROCESS AFTER THIS POINT IF crash == 1
* => if imagecreate() used but not if imagecreatetruecolor()
*/
imagettftext($image, 20, 0, 8, 24, $white, $font, $text);
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
Expected result:
----------------
Display "Bug" white text on black background
Actual result:
--------------
Apache2 process get locked and browser wait for the
image forever.
After it is a matter of time for Apache2 to have
all processes locked depending on your ServerLimit
and ThreadsPerChild values.
--
Edit bug report at http://bugs.php.net/?id=42416&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42416&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42416&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42416&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42416&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42416&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42416&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42416&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42416&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42416&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42416&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42416&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42416&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42416&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42416&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42416&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42416&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42416&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42416&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42416&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42416&r=mysqlcfg