danog / MadelineProto

Async PHP client API for the telegram MTProto protocol
https://docs.madelineproto.xyz
GNU Affero General Public License v3.0
2.83k stars 654 forks source link

\danog\MadelineProto\Exception: stream_socket_accept(): Accept failed: Too many open files #1441

Closed n2ref closed 10 months ago

n2ref commented 10 months ago

You may have already encountered this problem. Having a service that is not the busiest, I encounter it at least once a week. I have debian 11 installed, it has a default limit of 1024 open files. And I don't understand why this limit is not enough, it seems like a huge limit.

I can increase this limit using a command ulimit -n 16384 or set them in a file /etc/security/limits.conf, as they advise to do on the Internet. But maybe this is some kind of non-standard situation and it’s better to correct its source?

entry:  \danog\MadelineProto\Exception: stream_socket_accept(): Accept failed: Too many open files in /var/www/htdocs/mod/sources/v1.0.0/vendor/danog/ipc/lib/IpcServer.php:178
danog commented 10 months ago

1024 is an incredibly low limit, as this covers not just files, but also network TCP/UDP/UNIX sockets, pipes and much more.

I recommend setting both a hard and soft limit of 1048576 in limits.conf.

n2ref commented 10 months ago

Thanks for the answer. As far as I see, this is not described in the instructions on your website in the Requirements section. Perhaps this would be useful to people like me.