On 30 January 2012 14:22, Rob Stewart <robstewart57@gmail.com> wrote:
Hi,
I'm experiencing the "accept: resource exhausted (Too many open
files)" exception when trying to use sockets in my Haskell program.
The situation:
- Around a dozen Linux machines running my Haskell program,
transmitting thousands of messages to each other, sometimes within a
small period of time.
$ ulimit -n
1024
Indeed, when I experience the "accept: resource exhausted (Too many
open files)" exception, I check the number of open sockets, which
exceeds 1024, by looking at the contents of the directory:
ls -lah /proc/<prod_id>/fd
It is within the getContents function that, once the lazy bytestring
is fully received, the socket is shutdown http://goo.gl/B6XcV :
shutdown sock ShutdownReceive
There seems to be no way of limiting the number of permitted
connection requests from remote nodes. What I am perhaps looking for
is a mailbox implementation on top of sockets, or another way to avoid
this error. I am looking to scale up to 100's of nodes, where the
possibility of more than 1024 simultaneous socket connections to one
node is increased. Merely increasing the ulimit feels like a temporary
measure. Part of the dilemma is that the `connect' call in `sendMsg'
does not throw an error, despite the fact that it does indeed cause an
error on the receiving node, by pushing the number of open connections
to the same socket on the master node, beyond the 1024 limit permitted
by the OS.
Am I missing something? One would have thought such a problem occurs
frequently with Haskell web servers and the like.. ?
--
Rob Stewart
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe