php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37025 FD_SETSIZE error
Submitted: 2006-04-09 16:59 UTC Modified: 2006-04-10 13:16 UTC
From: linuxapps at yahoo dot com Assigned:
Status: Not a bug Package: Sockets related
PHP Version: 5.1.2 OS: Fedora Core 4
Private report: No CVE-ID: None
 [2006-04-09 16:59 UTC] linuxapps at yahoo dot com
Description:
------------
When compiled with --disable-cgi, PHP CLI throws an 
error on socket_select() when socket count > 1024.

It appears that the CLI installation defaults to 
FD_SETSIZE=1024 regardless of what is set at compile 
time via --enable-fd-setsize. PHP CGI, however, works 
properly.

This error happens identically to both sockets and 
socket streams (e.g. stream_select()). The code example 
uses sockets.



Reproduce code:
---------------
http://fourthround.com/bugs/server.txt
http://fourthround.com/bugs/stester.txt

Expected result:
----------------
As long as the OS's open file limit has not been 
exceeded PHP CLI should not throw an error when compiled 
with --enable-fd-setsize=4096 and socket_select on over 
1024 sockets.

Actual result:
--------------
Warning: socket_select(): You MUST recompile PHP with a 
larger value of FD_SETSIZE. It is set to 1024, but you 
have descriptors numbered at least as high as 1054. --
enable-fd-setsize=2048 is recommended, but you may want 
to set it to equal the maximum number of open files 
supported by your system, in order to avoid seeing this 
error again at a later date.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-09 21:52 UTC] linuxapps at yahoo dot com
Correction. Bug appears in CLI and CGI modes.
 [2006-04-09 21:59 UTC] tony2001@php.net
What is the value of __FD_SETSIZE in /usr/include/bits/typesizes.h ?
 [2006-04-10 12:54 UTC] linuxapps at yahoo dot com
Exactly 1024!

/* Number of descriptors that can fit in an `fd_set'.  
*/
#define __FD_SETSIZE            1024
 [2006-04-10 13:16 UTC] linuxapps at yahoo dot com
Thanx. Changing the value inside usr/include/bits/
typesizes.h and recompiling PHP fixed the problem.

This is obviously not a PHP bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 06:01:29 2024 UTC