LOG_EVERY_N instead of every time
authorScott Michelson <sdmich@fb.com>
Sat, 28 Oct 2017 00:33:45 +0000 (17:33 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sat, 28 Oct 2017 00:39:55 +0000 (17:39 -0700)
Summary: when queues fill, this starts blowing up, affecting server performance and making logs useless. It's useful to know queues are full, but we don't need the log every time we try to append

Reviewed By: yfeldblum

Differential Revision: D6175784

fbshipit-source-id: b4e6966087c4a6f9fba51d7f9193b9f41e13b899

folly/io/async/AsyncServerSocket.cpp

index 19bc823f2fce2f1c04dbe881340eee3c03177cef..0d3684ed0e3ae5ae820932a2323d52bfb0d3faa2 100644 (file)
@@ -962,8 +962,8 @@ void AsyncServerSocket::dispatchSocket(int socket,
       // should use pauseAccepting() to temporarily back off accepting new
       // connections, before they reach the point where their threads can't
       // even accept new messages.
-      LOG(ERROR) << "failed to dispatch newly accepted socket:"
-                 << " all accept callback queues are full";
+      LOG_EVERY_N(ERROR, 100) << "failed to dispatch newly accepted socket:"
+                              << " all accept callback queues are full";
       closeNoInt(socket);
       if (connectionEventCallback_) {
         connectionEventCallback_->onConnectionDropped(socket, addr);
@@ -1002,9 +1002,10 @@ void AsyncServerSocket::dispatchError(const char *msgstr, int errnoValue) {
     if (callbackIndex_ == startingIndex) {
       // The notification queues for all of the callbacks were full.
       // We can't really do anything at this point.
-      LOG(ERROR) << "failed to dispatch accept error: all accept callback "
-        "queues are full: error msg:  " <<
-        msg.msg.c_str() << errnoValue;
+      LOG_EVERY_N(ERROR, 100)
+          << "failed to dispatch accept error: all accept"
+          << " callback queues are full: error msg:  " << msg.msg << ": "
+          << errnoValue;
       return;
     }
     info = nextCallback();