Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57357 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40069 invoked from network); 13 Jan 2012 16:36:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jan 2012 16:36:53 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.160.170 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.160.170 mail-gy0-f170.google.com Received: from [209.85.160.170] ([209.85.160.170:44771] helo=mail-gy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4E/E4-14190-1AD501F4 for ; Fri, 13 Jan 2012 11:36:52 -0500 Received: by ghbf19 with SMTP id f19so251446ghb.29 for ; Fri, 13 Jan 2012 08:36:46 -0800 (PST) Received: by 10.236.148.235 with SMTP id v71mr3067687yhj.6.1326472606911; Fri, 13 Jan 2012 08:36:46 -0800 (PST) Received: from [192.168.200.5] (c-50-131-44-225.hsd1.ca.comcast.net. [50.131.44.225]) by mx.google.com with ESMTPS id i32sm24418679anm.22.2012.01.13.08.36.45 (version=SSLv3 cipher=OTHER); Fri, 13 Jan 2012 08:36:46 -0800 (PST) Message-ID: <4F105D9D.3010704@lerdorf.com> Date: Fri, 13 Jan 2012 08:36:45 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 MIME-Version: 1.0 To: Hannes Landeholm CC: internals@lists.php.net References: In-Reply-To: X-Enigmail-Version: 1.4a1pre Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] FD_SETSIZE warning? From: rasmus@lerdorf.com (Rasmus Lerdorf) 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