Description
On Linux, when using the examples/http
server and testing it with a large number of simultaneous connections, I commonly see one thread get stuck in an infinite loop, and the server fails to accept more connections.
After stepping through the issue in lldb
, I can see that the TCPListener
actor gets stuck in an infinite loop when it tries to run pony_os_accept
to accept a connection and that call fails with EMFILE
("too many open files") as the errno
. The TCPListener
is currently written to naively assume that any failure can be considered spurious, and it tries again to accept a connection. In this failure mode, trying again to accept a new connection will not help - it will always fail. Hence, it gets stuck in an infinite retry loop.