Repository: mesos Updated Branches: refs/heads/master 6e77b3529 -> d9cd0e318
Fixed race condition in Latch. There is a race condition in Latch. The same pid can be terminated by 2 seperate threads simultaneously. Review: https://reviews.apache.org/r/26783 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d9cd0e31 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d9cd0e31 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d9cd0e31 Branch: refs/heads/master Commit: d9cd0e318d0261e39ff4b91f494117ab3a555a4e Parents: 6e77b35 Author: Joris Van Remoortere <[email protected]> Authored: Wed Oct 22 13:02:08 2014 -0700 Committer: Niklas Q. Nielsen <[email protected]> Committed: Wed Oct 22 13:02:08 2014 -0700 ---------------------------------------------------------------------- 3rdparty/libprocess/src/latch.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/d9cd0e31/3rdparty/libprocess/src/latch.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/latch.cpp b/3rdparty/libprocess/src/latch.cpp index 89185ec..cba4dcd 100644 --- a/3rdparty/libprocess/src/latch.cpp +++ b/3rdparty/libprocess/src/latch.cpp @@ -26,7 +26,9 @@ Latch::Latch() Latch::~Latch() { - terminate(pid); + if (__sync_bool_compare_and_swap(&triggered, false, true)) { + terminate(pid); + } }
