You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by nn...@apache.org on 2015/01/16 23:14:48 UTC

mesos git commit: Fixed MESOS-2049 by using circular_buffer>.

Repository: mesos
Updated Branches:
  refs/heads/master 7c45541a8 -> c4b22a82b


Fixed MESOS-2049 by using circular_buffer<Owned<MonitoringInfo>>.

`circular_buffer` uses `memset` to assign elements. We were using
`circular_buffer<MonitoringInfo>`, `MonitoringInfo` contains
`ExecutorInfo`, and `ExecutorInfo` is a dynamic class (due to some
protobuf implementation probably).

The default warning levels on clang tells us that we can't simply
perform `memset` on dynamic classes because we'll overwrite the vtable
pointer which will lead to badness.

This patch fixes the issue by using
`circular_buffer<Owned<MonitoringInfo>>` instead, which is what we do
across the codebase wherever we use `circular_buffer`.

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


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

Branch: refs/heads/master
Commit: c4b22a82b9701207ae71715e5635a34577aecd8d
Parents: 7c45541
Author: Michael Park <mc...@gmail.com>
Authored: Fri Jan 16 13:31:06 2015 -0800
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Fri Jan 16 14:05:46 2015 -0800

----------------------------------------------------------------------
 src/slave/monitor.cpp | 4 +++-
 src/slave/monitor.hpp | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c4b22a82/src/slave/monitor.cpp
----------------------------------------------------------------------
diff --git a/src/slave/monitor.cpp b/src/slave/monitor.cpp
index 1c02986..398af01 100644
--- a/src/slave/monitor.cpp
+++ b/src/slave/monitor.cpp
@@ -89,7 +89,9 @@ Future<Nothing> ResourceMonitorProcess::stop(
   }
 
   // Add the monitoring information to the archive.
-  archive.push_back(monitored[containerId]);
+  archive.push_back(
+      process::Owned<MonitoringInfo>(
+          new MonitoringInfo(monitored[containerId])));
   monitored.erase(containerId);
 
   return Nothing();

http://git-wip-us.apache.org/repos/asf/mesos/blob/c4b22a82/src/slave/monitor.hpp
----------------------------------------------------------------------
diff --git a/src/slave/monitor.hpp b/src/slave/monitor.hpp
index 02b2ce1..f4ebafc 100644
--- a/src/slave/monitor.hpp
+++ b/src/slave/monitor.hpp
@@ -28,6 +28,7 @@
 
 #include <process/future.hpp>
 #include <process/limiter.hpp>
+#include <process/owned.hpp>
 #include <process/statistics.hpp>
 
 #include <stout/cache.hpp>
@@ -177,7 +178,7 @@ private:
   hashmap<ContainerID, MonitoringInfo> monitored;
 
   // Fixed-size history of monitoring information.
-  boost::circular_buffer<MonitoringInfo> archive;
+  boost::circular_buffer<process::Owned<MonitoringInfo>> archive;
 };
 
 } // namespace slave {