You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ch...@apache.org on 2018/08/24 20:21:05 UTC

[mesos] branch master updated: Unconditionally disabled boost debug mode.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9ddae42  Unconditionally disabled boost debug mode.
9ddae42 is described below

commit 9ddae428fbca6e41a9e58ad151f3b6fb4a3cd44c
Author: Benno Evers <be...@mesosphere.com>
AuthorDate: Fri Aug 24 13:20:47 2018 -0700

    Unconditionally disabled boost debug mode.
    
    Boost.CircularBuffer includes optional debugging code that counts the
    number of currently existing iterators to the container. Up to Boost
    1.62, this code was enabled by default.
    
    However, the existing iterators were stored in a linked list that was
    updated without any synchronization, leading to potential segfaults
    when reading the same buffer from multiple threads.
    
    Given that the Master stores the completed tasks for each framework
    in a circular buffer, and that this can be read from multiple threads
    when multiple batched requests to the `/state` endpoint are processed
    (introduced by MESOS-9122), we have to unconditionally disable Boost's
    debug mode to prevent possible segfaults.
    
    Review: https://reviews.apache.org/r/68484/
---
 src/master/master.hpp | 6 ++++++
 src/slave/slave.hpp   | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/src/master/master.hpp b/src/master/master.hpp
index dc0080b..e2e9bbf 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -25,6 +25,12 @@
 #include <string>
 #include <vector>
 
+// Using `boost::circular_buffer::debug_iterator` can lead to segfaults
+// because they are not thread-safe (see MESOS-9177), so we must ensure
+// they're disabled. Both versions of this macro are needed to account
+// for differences between older and newer Boost versions.
+#define BOOST_CB_DISABLE_DEBUG 1
+#define BOOST_CB_ENABLE_DEBUG 0
 #include <boost/circular_buffer.hpp>
 
 #include <mesos/mesos.hpp>
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index 0420109..28d6590 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -24,6 +24,9 @@
 #include <string>
 #include <vector>
 
+// See comments in `master.hpp` or MESOS-9177.
+#define BOOST_CB_DISABLE_DEBUG 1
+#define BOOST_CB_ENABLE_DEBUG 0
 #include <boost/circular_buffer.hpp>
 
 #include <mesos/attributes.hpp>