diff options
author | Maas-Maarten Zeeman <[email protected]> | 2016-01-13 11:57:47 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-09-19 14:18:43 +0200 |
commit | ad8c04cb721fe911db7c23b6a0d51d4d5dba82af (patch) | |
tree | 7ce8b7277d8c372e8a6266da1d25cc40e797b86f | |
parent | bd9bfdf42dd529072e56e94f8e0ca4315db7330a (diff) | |
download | ranch-ad8c04cb721fe911db7c23b6a0d51d4d5dba82af.tar.gz ranch-ad8c04cb721fe911db7c23b6a0d51d4d5dba82af.tar.bz2 ranch-ad8c04cb721fe911db7c23b6a0d51d4d5dba82af.zip |
Don't silently drop the accept rate
-rw-r--r-- | doc/src/guide/listeners.asciidoc | 18 | ||||
-rw-r--r-- | src/ranch_acceptor.erl | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/doc/src/guide/listeners.asciidoc b/doc/src/guide/listeners.asciidoc index 87e77d2..a776a58 100644 --- a/doc/src/guide/listeners.asciidoc +++ b/doc/src/guide/listeners.asciidoc @@ -203,6 +203,24 @@ ranch:set_max_connections(tcp_echo, MaxConns). The change will occur immediately. +=== When running out of file descriptors + +Operating systems have limits on the number of sockets +which can be opened by applications. When this maximum is +reached the listener can no longer accept new connections. The +accept rate of the listener will be automatically reduced, and a +warning message will be logged. + +---- +=ERROR REPORT==== 13-Jan-2016::12:24:38 === +Ranch acceptor reducing accept rate: out of file descriptors +---- + +If you notice messages like this you should increase the number +of file-descriptors which can be opened by your application. How +this should be done is operating-system dependent. Please consult +the documentation of your operating system. + === Using a supervisor for connection processes Ranch allows you to define the type of process that will be used diff --git a/src/ranch_acceptor.erl b/src/ranch_acceptor.erl index 3b28369..e889ba4 100644 --- a/src/ranch_acceptor.erl +++ b/src/ranch_acceptor.erl @@ -39,6 +39,7 @@ loop(LSocket, Transport, ConnsSup) -> %% We can't accept anymore anyway, so we might as well wait %% a little for the situation to resolve itself. {error, emfile} -> + error_logger:warning_msg("Ranch acceptor reducing accept rate: out of file descriptors~n"), receive after 100 -> ok end; %% We want to crash if the listening socket got closed. {error, Reason} when Reason =/= closed -> |