summaryrefslogtreecommitdiff
path: root/src/rabbit_networking.erl
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2012-01-25 15:03:53 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2012-01-25 15:03:53 +0000
commit23dfb01030191c016185c113e741a635a9eb01dc (patch)
tree0af3306c984bba1eb3e8ceee69dc7e65bd244eb5 /src/rabbit_networking.erl
parentceb1c9a7aac2e7401f9e803569dceb9f37c9add0 (diff)
downloadrabbitmq-server-23dfb01030191c016185c113e741a635a9eb01dc.tar.gz
move error_logger 'flow control' into application code
since tcp_acceptor no longer does any per-connection logging itself
Diffstat (limited to 'src/rabbit_networking.erl')
-rw-r--r--src/rabbit_networking.erl10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl
index 64318ac9..99bfb765 100644
--- a/src/rabbit_networking.erl
+++ b/src/rabbit_networking.erl
@@ -264,6 +264,16 @@ start_client(Sock, SockTransform) ->
{ok, _Child, Reader} = supervisor:start_child(rabbit_tcp_client_sup, []),
ok = rabbit_net:controlling_process(Sock, Reader),
Reader ! {go, Sock, SockTransform},
+
+ %% In the event that somebody floods us with connections, the
+ %% reader processes can spew log events at error_logger faster
+ %% than it can keep up, causing its mailbox to grow unbounded
+ %% until we eat all the memory available and crash. So here is a
+ %% meaningless synchronous call to the underlying gen_event
+ %% mechanism. When it returns the mailbox is drained, and we
+ %% return to our caller to accept more connetions.
+ gen_event:which_handlers(error_logger),
+
Reader.
start_client(Sock) ->