Bug #69637 [Com]: stream_select() warns: recompile php with FD_SETSIZE>1024 but it already is
| From: | erw at macrovita dot com dot br | Date: | Mon, 24 Apr 2017 19:06:02 +0000 |
| Subject: | Bug #69637 [Com]: stream_select() warns: recompile php with FD_SETSIZE>1024 but it already is | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208758@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69637&edit=1
ID: 69637
Comment by: erw at macrovita dot com dot br
Reported by: bousset1 at gmail dot com
Summary: stream_select() warns: recompile php with
FD_SETSIZE>1024 but it already is
Status: Verified
Type: Bug
Package: Sockets related
Operating System: linux (tested on ubuntu 14.04)
PHP Version: 5.6.8
Block user comment: N
Private report: N
New Comment:
If PHP process has more open file descriptors than FD_SETSIZE, it seems stream_select() will fail
even when trying to monitor just a couple file descriptors.
I get the error even when trying to stream_select() only 2 file descriptors, apparently because the
apache process has thousands of file descriptors open.
Environment: apache-2.4.23 event mpm, php-7.0.11, Gentoo Linux
// BTM11121, BTM10159
Previous Comments:
------------------------------------------------------------------------
[2016-11-08 10:45:07] kexianbin at diyism dot com
1.vi /usr/include/x86_64-linux-gnu/bits/typesizes.h:
#define __FD_SETSIZE 65536
2.compile:
./configure --with-curl --enable-fd-setsize=65536 CFLAGS='-D_FORTIFY_SOURCE=0'
make && sudo make install
3.vi /etc/security/limits.conf:
* soft nofile 65535
* hard nofile 65535
------------------------------------------------------------------------
[2016-07-03 12:30:29] cmb@php.net
Related To: Bug #43269
------------------------------------------------------------------------
[2016-07-02 15:20:57] cmb@php.net
Related To: Bug #72030
------------------------------------------------------------------------
[2016-05-31 21:05:34] deriamis at gmail dot com
The reason this appears to be happening is that sys/select.h on Linux is overriding FD_SETSIZE by
setting it to the value of __FD_SETSIZE, which is set statically to 1024, without checking that
it's already defined. The --enable-fd-setsize is not cross-platform and, people who need this
either have to patch PHP source in several places (bad) or system include files (worse). I think a
good way to do this is to set a dummy value and then in source set both FD_SETSIZE and __FD_SETSIZE
to the dummy value immediately before the sys/select.h include.
------------------------------------------------------------------------
[2015-08-27 23:57:01] cmb@php.net
After changing the definition of __FD_SETSIZE in bits/typesizes.h
the script runs fine for me (Debian Jessie) without warning,
except for the spurious "weird crash" error message. Did you
recompile *everything* after changing __FD_SETSIZE? And of course,
check whether FD_SETSIZE really changed.
Anyhow, I consider it a bug that --enable-fd-setsize might not
have any effect, without producing at least a meaningful warning
message. A respective check in configure.in would be appropriate.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=69637
--
Edit this bug report at https://bugs.php.net/bug.php?id=69637&edit=1