You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2018/05/31 17:10:45 UTC

mesos git commit: Fixed a crash in libprocess due to order-of-evaluation bug.

Repository: mesos
Updated Branches:
  refs/heads/master 228193754 -> fa41ca7dc


Fixed a crash in libprocess due to order-of-evaluation bug.

Up to C++17, the only ordering constraint on the evaluation of
expressions between synchronization points was that function
arguments shall be evaluated before calling a function.

This could lead to the situation where `std::move(futures)` could be
called before `await(futures.values())`, leading to a function call
on a moved-from object and thus undefined behaviour.

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


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

Branch: refs/heads/master
Commit: fa41ca7dcb60c6fcac8afc6ec35f36a69b90b65b
Parents: 2281937
Author: Benno Evers <be...@mesosphere.com>
Authored: Thu May 31 10:07:31 2018 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Thu May 31 10:08:52 2018 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/src/metrics/metrics.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/fa41ca7d/3rdparty/libprocess/src/metrics/metrics.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/metrics/metrics.cpp b/3rdparty/libprocess/src/metrics/metrics.cpp
index e0d0ee4..4883c9a 100644
--- a/3rdparty/libprocess/src/metrics/metrics.cpp
+++ b/3rdparty/libprocess/src/metrics/metrics.cpp
@@ -158,10 +158,12 @@ Future<map<string, double>> MetricsProcess::snapshot(
   Future<Nothing> timedout =
     after(timeout.getOrElse(Duration::max()));
 
+  vector<Future<double>> values = futures.values();
+
   // Return the response once it finishes or we time out.
   return select<Nothing>({
       timedout,
-      await(futures.values()).then([]{ return Nothing(); }) })
+      await(std::move(values)).then([]{ return Nothing(); }) })
     .onAny([=]() mutable { timedout.discard(); }) // Don't accumulate timers.
     .then(defer(self(),
                 &Self::__snapshot,