You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2015/12/12 19:28:57 UTC

mesos git commit: Fixed a deadlock introduced by the libprocess authentication code.

Repository: mesos
Updated Branches:
  refs/heads/master 6bd9b65b9 -> 0a6b820d1


Fixed a deadlock introduced by the libprocess authentication code.


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0a6b820d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0a6b820d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0a6b820d

Branch: refs/heads/master
Commit: 0a6b820d1502af8aeefff7524d1d0ce9ad8af69c
Parents: 6bd9b65
Author: Benjamin Mahler <be...@gmail.com>
Authored: Sat Dec 12 10:27:14 2015 -0800
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Sat Dec 12 10:27:14 2015 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/process.cpp | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/0a6b820d/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 43c83e3..af3cefb 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -197,6 +197,9 @@ public:
   // passed on to the route handlers.
   Future<Option<AuthenticationResult>> authenticate(const Request& request);
 
+protected:
+  void initialize() override;
+
 private:
   // Starts "waiting" on the next available future response.
   void next();
@@ -236,7 +239,7 @@ private:
   // the authentication router does expose ordered completion
   // of its Futures (it doesn't have the knowledge of sockets
   // necessary to do it in a per-connection manner).
-  Sequence authentications;
+  Owned<Sequence> authentications;
 };
 
 
@@ -1077,6 +1080,16 @@ HttpProxy::~HttpProxy()
 }
 
 
+void HttpProxy::initialize()
+{
+  // We have to construct the sequence outside of the HttpProxy
+  // constructor in order to prevent a deadlock between the
+  // SocketManager and the ProcessManager (see the comment in
+  // SocketManager::proxy).
+  authentications.reset(new Sequence());
+}
+
+
 void HttpProxy::enqueue(const Response& response, const Request& request)
 {
   handle(Future<Response>(response), request);
@@ -1104,7 +1117,7 @@ Future<Option<AuthenticationResult>> HttpProxy::authenticate(
   Future<Option<AuthenticationResult>> authentication =
     authentication_router->authenticate(request);
 
-  return authentications.add<Option<AuthenticationResult>>(
+  return authentications->add<Option<AuthenticationResult>>(
       [=]() { return authentication; });
 }