|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: a at webfiends dot com
New email:
PHP Version: OS:


 [2003-02-21 22:06 UTC] a at webfiends dot com
When including a remote URL...

<? include('') ?>

The socket to the remote server is left in CLOSE_WAIT. Eventually the Apache process runs out of file descriptors. (29)# netstat -an | grep       5840      0 24820      0 CLOSE_WAIT       5840      0 24820      0 CLOSE_WAIT
[...] (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
        sockname: AF_INET  port: 44988
        peername: AF_INET  port: 80
  14: S_IFSOCK mode:0666 dev:229,0 ino:25628 uid:0 gid:0 size:0
        sockname: AF_INET  port: 45008
        peername: AF_INET  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] (24)Too many open files: file permissions deny server access: /export/home/xxxxxx/html/includes/   

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 \


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-22 04:52 UTC]
Please try using this CVS snapshot:
For Windows:

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: Sun May 26 09:01:32 2024 UTC