diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2012-01-25 15:03:53 +0000 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-01-25 15:03:53 +0000 |
commit | 23dfb01030191c016185c113e741a635a9eb01dc (patch) | |
tree | 0af3306c984bba1eb3e8ceee69dc7e65bd244eb5 | |
parent | ceb1c9a7aac2e7401f9e803569dceb9f37c9add0 (diff) | |
download | rabbitmq-server-23dfb01030191c016185c113e741a635a9eb01dc.tar.gz |
move error_logger 'flow control' into application code
since tcp_acceptor no longer does any per-connection logging itself
-rw-r--r-- | src/rabbit_networking.erl | 10 | ||||
-rw-r--r-- | src/tcp_acceptor.erl | 8 |
2 files changed, 10 insertions, 8 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) -> diff --git a/src/tcp_acceptor.erl b/src/tcp_acceptor.erl index 4515d8e2..88da74c5 100644 --- a/src/tcp_acceptor.erl +++ b/src/tcp_acceptor.erl @@ -54,14 +54,6 @@ handle_info({inet_async, LSock, Ref, {ok, Sock}}, {ok, Mod} = inet_db:lookup_socket(LSock), inet_db:register_socket(Sock, Mod), - %% In the event that somebody floods us with connections we can - %% spew log events at error_logger faster than it can keep up. So - %% error_logger's mailbox grows unbounded until we eat all the - %% memory available and crash. So here's a meaningless synchronous - %% call to the underlying gen_event mechanism - when it returns - %% the mailbox is drained. - gen_event:which_handlers(error_logger), - %% handle file_handle_cache:transfer(apply(M, F, A ++ [Sock])), ok = file_handle_cache:obtain(), |