Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 177749

Summary: dev-lang/php-5.2.1 with builtin gd makes apache hang and eat memory
Product: Gentoo Linux Reporter: Srdjan Rosic <srdjan.rosic>
Component: [OLD] ServerAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Severity: critical    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---

Description Srdjan Rosic 2007-05-09 06:20:43 UTC
I tried to install a simple machines forum which uses imagettftext function in php (gd) to generate a new captcha image during registration. Apache process that tries to process it hangs and starts growing 4MB/s.

Reproducible: Always

Steps to Reproduce:
1. emerge apache with mpm-worker and php-5.2.1 with thread and gd use flag enabled
2. untar smf 1.1.2 to a vhost and do a basic setup
3. try to register (captcha is generated by default)

Actual Results:  
captcha image (verification code) is not displayed, and after about 30 seconds (I guess it depends on the ammount of resources available) apache is useless and other processes (ssh, ftp ...) come to a drag.

Expected Results:  
display the captcha image

using gd-external used gd-2.0.34 instead of gd-2.0.28 which was built-in in php.
I tried both apache 2.2.4 and apache 2.0.58.

you an find the offending function call in Sources/Subs-Graphics.php by searching for the string "@image" around line ~1500.

It was a shared hosting machine, good thing I caught it in time.
Comment 1 Srdjan Rosic 2007-05-09 06:25:26 UTC
Portage (default-linux/amd64/2006.1, gcc-4.1.1, glibc-2.4-r4, x86_64)
System uname: x86_64 Dual Core AMD Opteron(tm) Processor 265
Gentoo Base System release 1.12.9
Timestamp of tree: Sat, 05 May 2007 16:29:01 +0000
dev-lang/python:     2.4.3-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r2
CFLAGS="-O2 -pipe -march=opteron -fomit-frame-pointer"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/php/apache1-php5/ext-active/ /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=opteron -fomit-frame-pointer"
FEATURES="distlocks metadata-transfer parallel-fetch sandbox sfperms strict"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
USE="amd64 apache2 authdaemond bcmath berkdb bitmap-fonts bzip2 calendar cgi cli cracklib crypt curl curlwrappers dri exif expat fastcgi fortran ftp gd gdbm gmp gpm hash iconv imap ipv6 isdnlog libg++ logrotate mcal midi mnogosearch mpm-worker mysql mysqli ncurses nls nptl nptlonly openntpd pam pcre perl php ppds pppd python readline reflection rrdtool sasl session simplexml soap sockets spell spl sqlite ssl tcpd threads truetype truetype-fonts type1-fonts unicode urandom vhosts xml xml-rpc xmlreader xmlwriter xorg xsl zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark ati chips cirrus cyrix dummy fbdev glint i128 i810 mga neomagic nv rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"
Comment 2 Srdjan Rosic 2007-05-09 06:28:19 UTC
maybe disabling built-in gd and forcing gd-external for 5.2.1 would be a viable solution since php 5.2.2 will probably containg newer builtin gd.
Comment 3 Jakub Moc (RETIRED) gentoo-dev 2007-05-09 06:57:49 UTC
Please, test w/ 5.2.2 and reopen it it's still an issue. PHP 5.2.1 will be removed as soon as 5.2.2 gets stable on all arches due to numerous security vulnerabilities.
Comment 4 Srdjan Rosic 2007-05-09 08:41:29 UTC
emerged dev-lang/php-5.2.2-r1 with gd bundled in and everything works as expected.
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2007-05-09 19:41:45 UTC
Thanks for reporting. See Bug 169372 for 5.2.2 stabilization.