php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46218 apache2 reaches max clients limit with error in php_stdiop_set_option
Submitted: 2008-10-02 13:47 UTC Modified: 2009-10-27 10:04 UTC
Votes:16
Avg. Score:4.9 ± 0.5
Reproduced:13 of 13 (100.0%)
Same Version:11 (84.6%)
Same OS:6 (46.2%)
From: funky2step at gmail dot com Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.2.6 OS: RHEL ES Rel 4 (Nahant Update 6)
Private report: No CVE-ID: None
 [2008-10-02 13:47 UTC] funky2step at gmail dot com
Description:
------------
PHP is running with apache 2.2.9 (mpm=prefork)

./configure  --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5 --with-mysql --with-gd --with-png-dir=/usr --with-jpeg-dir=/usr --with-freetype-dir=/usr --enable-mbstring --with-apxs2=/usr/local/apache2/bin/apxs --with-xsl --with-curl=/usr/include --with-curlwrappers

The server reaches the maxclients limit but does not ever kill the old processes.
The server does not respond to any more requests. This is not due to heavy load.

GDB output shows an error in php_stdiop_set_option (see trace in actual result section)

GDB output of all httpd processes attached to sockets in CLOSE_WAIT state show the same as above.

Actual result:
--------------
Attaching to process 14035
Reading symbols from /usr/local/apache2/bin/httpd...done.
Using host libthread_db library "/lib/tls/libthread_db.so.1".
Reading symbols from /usr/lib/libz.so.1...done.
Loaded symbols for /usr/lib/libz.so.1
Reading symbols from /lib/tls/libm.so.6...done.
Loaded symbols for /lib/tls/libm.so.6
Reading symbols from /usr/local/apache2/lib/libaprutil-1.so.0...done.
Loaded symbols for /usr/local/apache2/lib/libaprutil-1.so.0
Reading symbols from /usr/lib/libexpat.so.0...done.
Loaded symbols for /usr/lib/libexpat.so.0
Reading symbols from /usr/local/apache2/lib/libapr-1.so.0...done.
Loaded symbols for /usr/local/apache2/lib/libapr-1.so.0
Reading symbols from /lib/libuuid.so.1...done.
Loaded symbols for /lib/libuuid.so.1
Reading symbols from /lib/tls/librt.so.1...done.
Loaded symbols for /lib/tls/librt.so.1
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/tls/libpthread.so.0...done.
[Thread debugging using libthread_db enabled]
[New Thread -1208387904 (LWP 14035)]
Loaded symbols for /lib/tls/libpthread.so.0
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/tls/libc.so.6...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from /usr/local/apache2/modules/libphp5.so...done.
Loaded symbols for /usr/local/apache2/modules/libphp5.so
Reading symbols from /usr/lib/libexslt.so.0...done.
Loaded symbols for /usr/lib/libexslt.so.0
Reading symbols from /usr/lib/libfreetype.so.6...done.
Loaded symbols for /usr/lib/libfreetype.so.6
Reading symbols from /usr/lib/libpng12.so.0...done.
Loaded symbols for /usr/lib/libpng12.so.0
Reading symbols from /usr/lib/libjpeg.so.62...done.
Loaded symbols for /usr/lib/libjpeg.so.62
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /usr/local/lib/libcurl.so.4...done.
Loaded symbols for /usr/local/lib/libcurl.so.4
Reading symbols from /usr/lib/libxslt.so.1...done.
Loaded symbols for /usr/lib/libxslt.so.1
Reading symbols from /usr/lib/libxml2.so.2...done.
Loaded symbols for /usr/lib/libxml2.so.2
Reading symbols from /usr/lib/libgcrypt.so.11...done.
Loaded symbols for /usr/lib/libgcrypt.so.11
Reading symbols from /usr/lib/libgpg-error.so.0...done.
Loaded symbols for /usr/lib/libgpg-error.so.0
Reading symbols from /usr/lib/libidn.so.11...done.
Loaded symbols for /usr/lib/libidn.so.11
Reading symbols from /usr/lib/libldap-2.2.so.7...done.
Loaded symbols for /usr/lib/libldap-2.2.so.7
Reading symbols from /lib/libssl.so.4...done.
Loaded symbols for /lib/libssl.so.4
Reading symbols from /lib/libcrypto.so.4...done.
Loaded symbols for /lib/libcrypto.so.4
Reading symbols from /usr/lib/libgssapi_krb5.so.2...done.
Loaded symbols for /usr/lib/libgssapi_krb5.so.2
Reading symbols from /usr/lib/libkrb5.so.3...done.
Loaded symbols for /usr/lib/libkrb5.so.3
Reading symbols from /lib/libcom_err.so.2...done.
Loaded symbols for /lib/libcom_err.so.2
Reading symbols from /usr/lib/libk5crypto.so.3...done.
Loaded symbols for /usr/lib/libk5crypto.so.3
Reading symbols from /usr/lib/liblber-2.2.so.7...done.
Loaded symbols for /usr/lib/liblber-2.2.so.7
Reading symbols from /usr/lib/libsasl2.so.2...done.
Loaded symbols for /usr/lib/libsasl2.so.2
Reading symbols from /lib/libnss_dns.so.2...done.
Loaded symbols for /lib/libnss_dns.so.2
0x00b007a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2

Thread 1 (Thread -1208387904 (LWP 14035)):
#0  0x00b007a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
No symbol table info available.
#1  0x00bd4596 in flock () from /lib/tls/libc.so.6
No symbol table info available.
#2  0x0055d18b in php_stdiop_set_option (stream=0x13, option=6, value=2, ptrparam=0x0) at /usr/local/src/php-5.2.6/main/streams/plain_wrapper.c:609
  prot = Variable "prot" is not available.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-07 09:11 UTC] funky2step at googlemail dot com
Does anyone have any ideas about this? It's causing a lot of problems as it happens quite frequently.
 [2008-11-06 10:38 UTC] funky2step at googlemail dot com
Thanks for the reply. Do you actually know if there is a problem with the main release of php 5.2. I'm slightly cautious about installing a snapshot because it is a busy production site. Are there any issues with installing a snapshot?
 [2008-11-07 09:09 UTC] funky2step at googlemail dot com
I installed the latest snapshot of PHP5 (PHP 5.2.7RC3-dev) and the problem remains. In fact it has happened twice in the space of 24 hours.
This problem doesn't just occur with this particular server and its associated site but on all other php5.2.6 and apache2 installations.
Has no-one else seen this serious problem with busy sites using this software?
 [2009-03-13 14:23 UTC] mibrahim at mibrahim dot net
Same exact problem. Tested it by lowering MaxClients, apache hangs within 1 minute. The only temporary solution is to increase MaxClients way up, and restart the server with a cron job every period of time.
 [2009-03-25 16:11 UTC] funky2step at gmail dot com
We fixed this in the end by ditching apache2 and running php5 with apache 1.3.41
The problem has not occurred in the month or so since implementing it and considering it used to happen at least once per day, I think this is a decent solution.
 [2009-04-06 21:12 UTC] jani@php.net
What MPM did you use with Apache2?
 [2009-04-07 11:06 UTC] david at dsanders dot co dot uk
I too am seeing this bug on Apache 2.2.9 with PHP 5.2.6 using MPM Prefork. In a web crawler application that I have written it continually hangs up max clients.
 [2009-04-09 09:24 UTC] funky2step at googlemail dot com
We used the prefork mpm.
 [2009-04-14 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".
 [2009-10-08 20:04 UTC] apache at vacances-location dot net
I experiencing exactly the same problem, Apache2 crash with message "reaches the maxclients limit", with no load, and it don't kill the old processes. I have the same versions, but on Debian Lenny.

Somebody have a fix ?
 [2009-10-20 00:06 UTC] joliver at gmx dot at
Exactly the same problem here:
Debian Lenny, apache 2.2.9 (prefork), php 5.2.6, eaccelerator 0.9.5.3

Server crashes every few days with
"server reached MaxClients setting, consider raising the MaxClients setting"
When restarting several warnings "child process XXX still did not exit, sending a SIGTERM" show up (however much less than MaxClients).

We first suspected a Slowloris attack, however we can rule out this after counting new connections in the firewall-logs.
 [2009-10-20 19:27 UTC] srinatar@php.net
to me, it sounds more like configuration issue rather than a possible bug within php. if your application is taking time to long to process , then either you will need to reduce the maximum execution time of your php script (within php.ini) or increase apache's max client value to address to your system load..

did you try to reduce the maximum_execution_time in your php.ini setting to make sure that your php scripts are terminated after some time ?

if you think it is some php bug that is causing it, get pstack output of your php process on a regular basis and see what all these processes are doing
 [2009-10-27 09:36 UTC] joliver at gmx dot at
Thank you for your response. We found out the problem yesterday, it was eaccelerator, not php/apache.

The problem described before occured when eaccelerator didn't have any memory left (shm_size) which happend regularily depending on the number of visits. 
Sorry for accusing php/apache, the reason for the problem wasn't easy to find.
 [2009-10-27 10:04 UTC] johannes@php.net
Do not file bugs when you have Zend extensions (zend_extension=)
loaded. Examples are Zend Optimizer, Zend Debugger, Turck MM Cache,
APC, Xdebug and ionCube loader.  These extensions often modify engine
behavior which is not related to PHP itself.


 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Oct 22 16:01:28 2019 UTC