#43105 [Opn->Csd]: PHP seems to fail to close open files.
| From: | bjori@php.net | Date: | Thu, 27 Dec 2007 02:13:23 +0000 |
| Subject: | #43105 [Opn->Csd]: PHP seems to fail to close open files. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-120875@lists.php.net to get a copy of this message | ||
ID: 43105
Updated by: bjori@php.net
Reported By: ian at onlineloop dot com
-Status: Open
+Status: Closed
Bug Type: Apache2 related
Operating System: Solaris, Linux, Mac OS X
PHP Version: 5.2.5RC2-dev
-Assigned To:
+Assigned To: bjori
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Thanks to Igors awesome debugging skillz :)
Previous Comments:
------------------------------------------------------------------------
[2007-12-27 01:54:45] ifeghali@php.net
It seems that the bug was introduced here:
http://cvs.php.net/viewvc.cgi/php-src/main/fopen_wrappers.c?revision=1.175.2.3.2.14&view=markup&pathrev=PHP_5_2
(revision 1.175.2.3.2.14 of fopen_wrappers.c)
------------------------------------------------------------------------
[2007-12-26 22:22:41] ifeghali@php.net
I did some more tests:
PHP 4.4.7: couldn't reproduce
PHP 5.1.6: couldn't reproduce
PHP 5.2.4: couldn't reproduce
PHP 5.2.5: problem found
PHP 5.3-200712262130: problem found
------------------------------------------------------------------------
[2007-12-26 21:34:25] ifeghali@php.net
I can't reproduce the bug in PHP 5.1.6 on Darwin Kernel Version 8.11.1,
which makes me think its an issue of 5.2.5 only.
------------------------------------------------------------------------
[2007-12-23 14:08:14] ifeghali@php.net
Apache 1.3.33 and PHP 5.2.5 running on Darwin Kernel Version 8.11.1
(Mac OS X 10.4.11) compiled with configure command (gcc):
'./configure' '--prefix=/usr/local' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--with-apxs' '--with-kerberos'
'--enable-cli' '--enable-exif' '--enable-ftp'
'--enable-mbstring'
'--enable-mbregex' '--enable-sockets' '--with-curl'
'--with-config-file-path=/private/etc' '--sysconfdir=/private/etc'
'--with-mysql=/usr/local/mysql' '--with-mysql-sock=/tmp/mysql.sock'
'--without-pear' '--with-gd' '--enable-gd-native-ttf'
'--with-png-dir'
'--with-zlib' '--with-bz2' '--with-libxml-dir'
'--with-mysqli=/usr/local/mysql/bin/mysql_config' '--enable-sqlite-utf8'
'--enable-zip' '--disable-cgi'
doesn't seems to be closing open files (requires, includes etc.) which
ends up with the error "Too many open files" very often.
# apachectl restart
# lsof -u www | wc -l
> 56
# lsof -u www | grep "\.php" | wc -l
no output
After running one PHP script:
# lsof -u www | grep "\.php" | wc -l
> 22
Another page hit:
# lsof -u www | grep "\.php" | wc -l
> 104
And so on... The number of open files just keeps increasing.
For some reason PHP 4.4.7 don't have this behavior, that is, apache
keeps the number of open files somewhat constant when PHP is not
running.
For phpMyAdmin the first entries of lsof looks like:
# lsof -u www | grep "\.php" | head
httpd 678 www 6r REG 14,2 26700 915904
/Users/data/htdocs/mysql/libraries/common.inc.php
httpd 678 www 7r REG 14,2 18504 915886
/Users/data/htdocs/mysql/libraries/core.lib.php
httpd 678 www 8r REG 14,2 2063 915950
/Users/data/htdocs/mysql/libraries/sanitizing.lib.php
httpd 678 www 9r REG 14,2 9447 915968
/Users/data/htdocs/mysql/libraries/Theme.class.php
httpd 678 www 10r REG 14,2 10571 915906
/Users/data/htdocs/mysql/libraries/Theme_Manager.class.php
httpd 678 www 11r REG 14,2 9447 915968
/Users/data/htdocs/mysql/libraries/Theme.class.php
httpd 678 www 12r REG 14,2 33846 915974
/Users/data/htdocs/mysql/libraries/Config.class.php
httpd 678 www 13r REG 14,2 44257 915868
/Users/data/htdocs/mysql/libraries/Table.class.php
httpd 678 www 14r REG 14,2 79607 915957
/Users/data/htdocs/mysql/libraries/common.lib.php
httpd 678 www 18r REG 14,2 1919 915824
/Users/data/htdocs/mysql/libraries/js_escape.lib.php
------------------------------------------------------------------------
[2007-11-29 16:03:43] marcus dot mueller at grintsch dot com
As I stated above we have this issue on two Linux boxes with
self-compiled PHP binaries. These were compiled using gcc!
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/43105
--
Edit this bug report at http://bugs.php.net/?id=43105&edit=1