From:             a at webfiends dot com
Operating system: Solaris 8
PHP version:      4.3.1
PHP Bug Type:     Sockets related
Bug description:  CLOSE_WAIT sockets cause Apache to hit nofiles rlimit

When including a remote URL...

[...]
<? include('http://www.php.net') ?>
[...]

The socket to the remote server is left in CLOSE_WAIT. Eventually the
Apache process runs out of file descriptors.

[EMAIL PROTECTED] (29)# netstat -an | grep 64.246.30.37
63.111.105.8.44978   64.246.30.37.80       5840      0 24820      0
CLOSE_WAIT
63.111.105.8.44980   64.246.30.37.80       5840      0 24820      0
CLOSE_WAIT
[...]
[EMAIL PROTECTED] (30)# pfiles 4706
4706:   /usr/local/apache/1.3.27/bin/httpd -f
/etc/servers/apache/1.3.27/unixd
  Current rlimit: 262 file descriptors
[...]
  13: S_IFSOCK mode:0666 dev:229,0 ino:23031 uid:0 gid:0 size:0
      O_RDWR
        sockname: AF_INET 63.111.105.8  port: 44988
        peername: AF_INET 64.246.30.37  port: 80
  14: S_IFSOCK mode:0666 dev:229,0 ino:25628 uid:0 gid:0 size:0
      O_RDWR
        sockname: AF_INET 63.111.105.8  port: 45008
        peername: AF_INET 64.246.30.37  port: 80
[...]

This problem doesn't occur with 4.2.3 on Solaris 8.  When all of the file
desriptors have been used up, the child process can't include files or
lauch external processes e.g. sendmail.

[Thu Feb 20 12:02:48 2003] [error] [client 63.230.229.161] (24)Too many
open files: file permissions deny server access:
/export/home/xxxxxx/html/includes/common.inc   

Here's our configure line...
[..]
   env CC=gcc CFLAGS='-I/usr/local/openssl/0.9.7/include' \
   ./configure \
      --prefix=/usr/local/php/4.3.1 \
      --enable-safe-mode=yes \
      --enable-memory-limit=yes \
      --with-mysql=/usr/local/mysql/3.23.55 \
      --with-gd \
      --with-apxs=/usr/local/apache/1.3.27/bin/apxs \
      --with-jpeg-dir=/usr/local \
      --with-xpm-dir=/usr/local \
      --with-png-dir=/usr/local \
      --with-zlib-dir=/usr/local \
      --with-openssl=/usr/local/openssl/0.9.7 \
      --enable-wddx \
      --enable-debug=no
[..]


-- 
Edit bug report at http://bugs.php.net/?id=22370&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22370&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22370&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22370&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22370&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22370&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22370&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22370&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22370&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22370&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22370&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22370&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22370&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22370&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22370&r=gnused

Reply via email to