Reactphp Socket server in ratchet

192 views
Skip to first unread message

SergZ

unread,
Jul 3, 2014, 7:05:42 AM7/3/14
to ratch...@googlegroups.com
Hello

I came across an issue while implementing wamp php server using ratchet.

After a period of normal operation keep getting errors like

stream_socket_accept(): accept failed: Too many open files

Libevent is properly installed an is used by event loop (var_dump($loop)), but looks like reactphp socket server is still using stream_select.

Those errors start appearing when my php server reaches 1024 connections, which is nowhere near my ulimits. It looks like it is php default max fd set in

/usr/include/x86_64-linux-gnu/bits/typesizes.h
/usr/include/linux/posix_types.h
/usr/include/x86_64-linux-gnu/asm/posix_types.h
/usr/include/asm-generic/posix_types.h

My question is is it a problem of my ratchet usage, or is it react socket server normal way of working and not using libevent features.

cboden

unread,
Aug 10, 2014, 10:06:55 AM8/10/14
to ratch...@googlegroups.com
This is a security feature of your operating system preventing a single process from opening more than 1024 file descriptors (in this case accepting socket connections). On some systems there can be up to 3 places to configure this, ulimit is one of those. I recall pam.d is another place you will need to increase the limit. 

SergZ

unread,
Aug 12, 2014, 10:50:37 AM8/12/14
to ratch...@googlegroups.com
well it turned out to be quite simple-stupid. i wa using supervisor, whicj was imposing its own ulimits on all php processes it was supervising. normal way of increasing does the job, but you have to restart supervisord too.


one...@gmail.com

unread,
Feb 8, 2015, 6:17:31 AM2/8/15
to ratch...@googlegroups.com
Let me answer as blog post: http://1kit.net/2015/02/07/stream_socket_accept-accept-failed-too-many-open-files/

четверг, 3 июля 2014 г., 14:05:42 UTC+3 пользователь SergZ написал:
Reply all
Reply to author
Forward
0 new messages