[PATCH] Exit if an error occurs with the listening socket

Michael Santos <>
Sun Mar 21 02:30:04 CET 2010

On erlang-questions, there was a thread about epmd consuming 100% CPU
under some conditions:


Looking through the code for epmd_srv.c, when either select() or accept()
returns an error, errno is not checked. In the case of an error with
the socket, this will cause select/accept to return immediately and loop.

The easiest way of reproducing this situation is by using too many
file descriptors:


In one shell:

$ ulimit -n 16
$ epmd -d -port 1234

In another shell:

$ erl
$ emfile:start(1234,32).

epmd will log many errors and consume CPU:

epmd: Sat Mar 20 20:09:45 2010: error in accept: Too many open files

Since my github fork is "temporarily unavailable", the patch will be
sent separately in git patch format. If the patch needs to be re-worked,
please let me know, and I will do so when my fork is back up.

More information about the erlang-patches mailing list