emfile error

Rick Pettit rpettit@REDACTED
Mon Dec 3 22:44:09 CET 2001


I have an erlang process which runs as a concurrent TCP server.  It
functions as a gateway between non-erlang processes and Erlang processes.

The server listens on a well-known TCP port and spawns a child to handle
each request.  The child will parse TCP input and forward the request via
Erlang messaging to the appropriate Erlang server, waiting for a response
(another Erlang message) before responding over TCP and closing the TCP
connection.

The problem is that when the server is hit hard the clients receive an
emfile error, which I understand could be the result of a UNIX process
(the erlang node, in this case) running out of descriptors.

Is this a known problem with concurrent erlang servers?  I would not
expect this same error if my server was in C and it fork()'d children, as
each child would then have its own descriptor table and would have very
few entries in it (stdin, stdout, stderr, TCP client socket).

I wonder if the entire node appears to the host OS as a single process
(perhaps one with many threads), in which case I would expect this problem
with most any concurrent server.

Please forgive me if I am doing something silly or am missing some
fundemental coding convention that would have alleviated this problem.

Rick




More information about the erlang-questions mailing list