This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch 1.6.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 2e0b848f3cd7a2ed03b3da0754d8a6609f8f5880
Author: Benjamin Mahler <bmah...@apache.org>
AuthorDate: Thu May 16 11:42:26 2019 +0200

    Added logging of slow reverse DNS when accepting SSL connections.
    
    Slow reverse DNS lookup is a serious issue since today it is done
    synchronously from the event loop thread, see MESOS-9339 and
    related tickets. Logging slow requests will substantially improve
    debugging.
    
    Review: https://reviews.apache.org/r/70653
---
 3rdparty/libprocess/src/libevent_ssl_socket.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/3rdparty/libprocess/src/libevent_ssl_socket.cpp 
b/3rdparty/libprocess/src/libevent_ssl_socket.cpp
index 436b389..520ec41 100644
--- a/3rdparty/libprocess/src/libevent_ssl_socket.cpp
+++ b/3rdparty/libprocess/src/libevent_ssl_socket.cpp
@@ -26,6 +26,7 @@
 #include <process/ssl/flags.hpp>
 
 #include <stout/net.hpp>
+#include <stout/stopwatch.hpp>
 #include <stout/synchronized.hpp>
 
 #include <stout/os/close.hpp>
@@ -1152,7 +1153,19 @@ void 
LibeventSSLSocketImpl::accept_SSL_callback(AcceptRequest* request)
           Option<string> peer_hostname = None();
 
           if (request->ip.isSome()) {
+            Stopwatch watch;
+
+            watch.start();
             Try<string> hostname = net::getHostname(request->ip.get());
+            watch.stop();
+
+            // Due to MESOS-9339, a slow reverse DNS lookup will cause
+            // serious issues as it blocks the event loop thread.
+            if (watch.elapsed() > Milliseconds(100)) {
+              LOG(WARNING) << "Reverse DNS lookup for '" << *request->ip << "'"
+                           << " took " << watch.elapsed().ms() << "ms"
+                           << ", slowness is problematic (see MESOS-9339)";
+            }
 
             if (hostname.isError()) {
               VLOG(2) << "Could not determine hostname of peer: "

Reply via email to