On 01/13/2012 05:13 AM, Hannes Landeholm wrote:
> I'm flooded with this warning when my system is under a high load and uses
> a lot of sockets/file descriptors. I get it in stream_select:
> 
> "E_WARNING: E_WARNING caught: stream_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
> 1024.
>  --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."
> 
> Why would you even have a limit for this? Having your application suddenly
> crash because of some undocumented arbitrary internal PHP limit is a real
> punch-in-the-face for people trying to build robust PHP-CGI applications.
> Can someone explain to me why I need to be bothered about this?

FD_SETSIZE is a system limit on the number of open files a single
process can have. From a bash shell type: ulimit -n
and you will probably see this magical 1024 number pop up. This means
that the default is 1024 on your system, so raising it in PHP won't
actually do anything unless you also raise it on your system. We try to
match the limit in order to give you a sensible error message instead of
your program just breaking quietly, or with a warning that doesn't tell
you that it is due to hitting a system limit.

So, in order to raise this you have to both tell your operating system
that you want to allow individual processes to open more than 1024 files
each and you have to recompile PHP with this higher limit.

Now, having said that, I don't quite understand why a single PHP cgi
process would ever need more than 1024 open files at the same time. What
exactly are you doing that needs this many descriptors? Sounds like you
have a descriptor leak there somehow.

-Rasmus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to