You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2018/10/04 13:47:35 UTC

[mesos] 03/08: Fixed ssl build specific incompatiblity with libevent later than 2.1.5.

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

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

commit e67022fd95571fb093e41ad5fc92457328e7f91f
Author: Till Toenshoff <to...@me.com>
AuthorDate: Thu Oct 4 15:40:43 2018 +0200

    Fixed ssl build specific incompatiblity with libevent later than 2.1.5.
    
    Up until and including libevent 2.1.5 (beta) the buffer events EV_READ
    and EV_WRITE were enabled by default in the openssl related socket
    setup.
    
    That got changed by f4b6284b8393dbabf389ddce734a30f4cdeffa17 within
    libevent; the default expectancy of read and write buffer events got
    removed.
    
    The changes in libevent in turn caused our implementation on top of it
    to fail, typically directly after accept and connect calls.
    
    The libevent maintainer Azat Khuzhin has generously been helping us out
    by debugging and fixing the incomplete setup within libprocess.
    
    This patch is based on Azat's suggestions from https://goo.gl/4CK3PD.
    It has been validated against libevent 2.0.22, 2.1.8 and 2.2 (alpha)
    on macOS 10.14.1 and Ubuntu 16.04.
    
    Review: https://reviews.apache.org/r/68906/
---
 3rdparty/libprocess/src/posix/libevent/libevent_ssl_socket.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/3rdparty/libprocess/src/posix/libevent/libevent_ssl_socket.cpp b/3rdparty/libprocess/src/posix/libevent/libevent_ssl_socket.cpp
index 436b389..bc8f782 100644
--- a/3rdparty/libprocess/src/posix/libevent/libevent_ssl_socket.cpp
+++ b/3rdparty/libprocess/src/posix/libevent/libevent_ssl_socket.cpp
@@ -595,6 +595,10 @@ Future<Nothing> LibeventSSLSocketImpl::connect(const Address& address)
               &LibeventSSLSocketImpl::event_callback,
               CHECK_NOTNULL(self->event_loop_handle));
 
+          // Explicitly enable read and write bufferevents as needed
+          // for libevent >= 2.1.6. See MESOS-9265.
+          bufferevent_enable(self->bev, EV_READ | EV_WRITE);
+
           if (bufferevent_socket_connect(
                   self->bev,
                   reinterpret_cast<sockaddr*>(&addr),
@@ -1207,6 +1211,10 @@ void LibeventSSLSocketImpl::accept_SSL_callback(AcceptRequest* request)
               &LibeventSSLSocketImpl::event_callback,
               CHECK_NOTNULL(impl->event_loop_handle));
 
+          // Explicitly enable read and write bufferevents as needed
+          // for libevent >= 2.1.6. See MESOS-9265.
+          bufferevent_enable(bev, EV_READ | EV_WRITE);
+
           request->promise.set(std::dynamic_pointer_cast<SocketImpl>(impl));
         } else if (events & BEV_EVENT_ERROR) {
           std::ostringstream stream;