You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2016/11/23 00:29:06 UTC

[4/5] mesos git commit: Moved server socket deletion in 'process::finalize()'.

Moved server socket deletion in 'process::finalize()'.

We need to destroy the server socket and discard its
future before we finalize the process manager
because the socket's `onDiscard` callback may need to
run in the event loop (such as for libevent sockets), but
process manager finalization stops the event loop.

Review: https://reviews.apache.org/r/53975/


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

Branch: refs/heads/master
Commit: 5efc83f4937d6b03e66995fa15be01f63fd24fb1
Parents: e1c9072
Author: Greg Mann <gr...@mesosphere.io>
Authored: Tue Nov 22 13:46:06 2016 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Tue Nov 22 13:46:06 2016 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/process.cpp | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5efc83f4/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index b5ee0b3..47341f7 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -1198,6 +1198,18 @@ void finalize()
   delete processes_route;
   processes_route = nullptr;
 
+  // Close the server socket.
+  // This will prevent any further connections managed by the `SocketManager`.
+  synchronized (socket_mutex) {
+    // Explicitly terminate the callback loop used to accept incoming
+    // connections. This is necessary as the server socket ignores
+    // most errors, including when the server socket has been closed.
+    future_accept.discard();
+
+    delete __s__;
+    __s__ = nullptr;
+  }
+
   // Terminate all running processes and prevent further processes from
   // being spawned. This will also clean up any metadata for running
   // processes held by the `SocketManager`. After this method returns,
@@ -1213,18 +1225,6 @@ void finalize()
   // stopped, no timers will fire.
   Clock::finalize();
 
-  // Close the server socket.
-  // This will prevent any further connections managed by the `SocketManager`.
-  synchronized (socket_mutex) {
-    // Explicitly terminate the callback loop used to accept incoming
-    // connections. This is necessary as the server socket ignores
-    // most errors, including when the server socket has been closed.
-    future_accept.discard();
-
-    delete __s__;
-    __s__ = nullptr;
-  }
-
   // Clean up the socket manager.
   // Terminating processes above will also clean up any links between
   // processes (which may be expressed as open sockets) and the various