You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2017/01/20 22:32:18 UTC

mesos git commit: Eliminated a race in libprocess 'Loop'.

Repository: mesos
Updated Branches:
  refs/heads/master c159516db -> 614673ac7


Eliminated a race in libprocess 'Loop'.

In `process::internal::Loop`, we intend to synchronize all
accesses to the `discard` member, since otherwise there would
be a race between setting and calling this lambda. However,
one assignment of the member remains unsynchronized. This
patch synchronizes this assignment to avoid a race.

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


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

Branch: refs/heads/master
Commit: 614673ac75e69b0a29e0e434a2ee676e8afa9b9d
Parents: c159516
Author: Greg Mann <gr...@mesosphere.io>
Authored: Fri Jan 20 14:31:32 2017 -0800
Committer: Anand Mazumdar <an...@apache.org>
Committed: Fri Jan 20 14:31:32 2017 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/loop.hpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/614673ac/3rdparty/libprocess/include/process/loop.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/loop.hpp b/3rdparty/libprocess/include/process/loop.hpp
index 8bd9715..ece16fa 100644
--- a/3rdparty/libprocess/include/process/loop.hpp
+++ b/3rdparty/libprocess/include/process/loop.hpp
@@ -325,7 +325,9 @@ public:
     // captured futures longer than necessary.
     //
     // TODO(benh): Use `WeakFuture` in `discard` functions instead.
-    discard = []() {};
+    synchronized (mutex) {
+      discard = []() {};
+    }
 
     while (next.isReady()) {
       Future<ControlFlow<R>> flow = body(next.get());