php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22370 CLOSE_WAIT sockets cause Apache to hit nofiles rlimit
Submitted: 2003-02-21 22:06 UTC Modified: 2003-02-22 12:38 UTC
From: a at webfiends dot com Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.3.1 OS: Solaris 8
Private report: No CVE-ID: None
 [2003-02-21 22:06 UTC] a at webfiends dot com
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.

root@sweb-5134.atl7.sol.web.uu.net (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
[...]
root@sweb-5134.atl7.sol.web.uu.net (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
[..]


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-22 04:52 UTC] wez@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

A fix for Bug #21713 went into CVS last night; it will
most likely fix this problem as well.

Please try a stable snapshot and report back to us.
 [2003-02-22 12:38 UTC] a at webfiends dot com
Thanks, I used php4-STABLE-200302221630. Everything's good.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 20:01:29 2024 UTC