From: jordan at tumyeto dot net
Operating system: RedHat 2.4.7-10smp
PHP version: 4.3.2
PHP Bug Type: Apache related
Bug description: Writing error_log w/o write permissions sends Apache to 100%CPU/Seg faults
Description:
------------
Summary: If the directory containing error_log is not writeable, Apache
gets stuck taking 100% CPU.
Detail:
I recently set log_errors = On in php.ini, and began receiving a TON of
"[notice] child pid 15591 exit signal Segmentation fault (11)" in my
Apache error_log. In addition, a ton of "Allowed memory size of 8388608
bytes exhausted (tried to allocate 2 bytes)" began showing up as well.
Even worse, Apache child threads would shoot up to 100% CPU and over time
5-6 threads would all be fighting for that 100%, causing page serve
problems.
I come to find out that the directoy that error_log was set to go to was
not writeable by the webserver user. As soon as I make the directory
writeable (or turn off log_errors), all problems go away and the server
returns to normal operations.
'./configure' '--prefix=/usr/local'
'--with-apache=/usr/local/Apachetoolbox-1.5.66/apache_1.3.27'
'--enable-exif' '--enable-track-vars' '--with-calendar=shared'
'--enable-magic-quotes' '--enable-trans-sid' '--enable-wddx'
'--enable-ftp' '--enable-inline-optimization' '--enable-memory-limit'
'--with-gd=/usr/local' '--with-zlib' '--enable-gd-native-tt'
'--with-t1lib=/usr/local' '--with-jpeg-dir=/usr' '--with-png-dir=/usr'
'--with-zlib-dir=/usr' '--with-ttf' '--with-freetype-dir=/usr/local'
'--with-imap=/usr/sbin' '--with-openssl=/usr' '--with-gd'
'--with-zlib-dir=/usr' '--with-png-dir=/usr' '--with-jpeg-dir=/usr'
'--with-mysql' '--with-ldap' '--with-kerberos=/usr/kerberos'
Reproduce code:
---------------
1) Enable log_errors in php.ini
2) Set error_log to a directory not writeable by the webuser.
3) Create some php errors that you would expect to be logged into
error_log.
4) Send a lot of traffic to the server, watch your Apache's error_log and
watch Apache threads shoot up to 100% CPU.
Expected result:
----------------
If error_log cannot be written, abort instead of taking down Apache.
Actual result:
--------------
[notice] child pid 15591 exit signal Segmentation fault (11)
Allowed memory size of 8388608 bytes exhausted (tried to allocate 2
bytes)
--
Edit bug report at http://bugs.php.net/?id=24597&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24597&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24597&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=24597&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24597&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24597&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24597&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24597&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24597&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24597&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24597&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24597&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24597&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24597&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24597&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24597&r=gnused