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

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


The following commit(s) were added to refs/heads/master by this push:
     new 61e5fcd  Added logging of slow reverse DNS when accepting SSL 
connections.
61e5fcd is described below

commit 61e5fcd1a6cb9252454dda62b0d6c0be17c144d2
Author: Benjamin Mahler <[email protected]>
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
---
 .../libprocess/src/posix/libevent/libevent_ssl_socket.cpp   | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/3rdparty/libprocess/src/posix/libevent/libevent_ssl_socket.cpp 
b/3rdparty/libprocess/src/posix/libevent/libevent_ssl_socket.cpp
index bc8f782..29a1bf7 100644
--- a/3rdparty/libprocess/src/posix/libevent/libevent_ssl_socket.cpp
+++ b/3rdparty/libprocess/src/posix/libevent/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>
@@ -1156,7 +1157,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