php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24597 Writing error_log w/o write permissions sends Apache to 100%CPU/Seg faults
Submitted: 2003-07-10 18:14 UTC Modified: 2003-07-14 20:52 UTC
From: jordan at tumyeto dot net Assigned:
Status: Not a bug Package: Apache related
PHP Version: 4.3.2 OS: RedHat 2.4.7-10smp
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jordan at tumyeto dot net
New email:
PHP Version: OS:

 

 [2003-07-10 18:14 UTC] jordan at tumyeto dot net
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)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-10 19:58 UTC] sniper@php.net
I can't reproduce this.

 [2003-07-10 21:39 UTC] jordan at tumyeto dot net
Try these php.ini settings:

display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 0
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = On
error_log = php_errors.log

I get the errors with these settings.  Setting log_errors and track_errors to OFF makes the problem go away.
 [2003-07-13 22:22 UTC] sniper@php.net
I still can't reproduce this. (using latest stable CVS)

 [2003-07-14 19:16 UTC] jordan at tumyeto dot net
More detail:
php_errors.log gets created in the home user's public_html directory.

/home/username/public_html/php_errors.log

If the Apache user is not given write access to  /home/username/public_html then this crash happens.  as soon as i do chmod a+w /home/username/public_html, the problem goes away.  Are you sure you've followed all of these requirments, and you still can't reproduce it?
 [2003-07-14 20:52 UTC] sniper@php.net
Yes, I'm sure, and no, I can't reproduce it using latest stable CVS checkout.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 09:01:30 2024 UTC