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 2016/01/12 02:34:57 UTC

[1/2] mesos git commit: Fixed a pointer ownership bug in Master::removeFramework.

Repository: mesos
Updated Branches:
  refs/heads/master 9632dd841 -> c2329163d


Fixed a pointer ownership bug in Master::removeFramework.

Previously, the framework being removed was pushed back to the circular
buffer of completed frameworks as a shared_ptr halfway through the
computation done to remove a framework from the master. The pointer to
the framework was then accessed again after this point.

Pushing a shared_ptr this way is fine so long as the push_pack succeeds
and the pointer is actually inserted into the buffer. However, with the
introduction of the new flags to set the size of this buffer via
max_completed_frameworks, it's possible for the size of this buffer to
be 0. As such, the circular buffer was taking control of the pointer,
noticing there was nowhere to push it, and then freeing it.  This causes
problems since the pointer is then accessed later on.

This patch moves the insertion of the shared pointer into the circular
buffer to the end of the removeFramework() call. This change should not
have any adverse effects.

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


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

Branch: refs/heads/master
Commit: c2329163d36167ac8a457067ed86212ab0875136
Parents: 40ebcee
Author: Kevin Klues <kl...@gmail.com>
Authored: Mon Jan 11 17:23:52 2016 -0800
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Mon Jan 11 17:34:43 2016 -0800

----------------------------------------------------------------------
 src/master/master.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c2329163/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 2d9b7f9..5268408 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -6040,9 +6040,6 @@ void Master::removeFramework(Framework* framework)
 
   framework->unregisteredTime = Clock::now();
 
-  // The completedFramework buffer now owns the framework pointer.
-  frameworks.completed.push_back(shared_ptr<Framework>(framework));
-
   const string& role = framework->info.role();
   CHECK(activeRoles.contains(role))
     << "Unknown role " << role
@@ -6076,6 +6073,9 @@ void Master::removeFramework(Framework* framework)
   // Remove the framework.
   frameworks.registered.erase(framework->id());
   allocator->removeFramework(framework->id());
+
+  // The completedFramework buffer now owns the framework pointer.
+  frameworks.completed.push_back(shared_ptr<Framework>(framework));
 }
 
 


[2/2] mesos git commit: Minor cleanup to protobuf::parse.

Posted by bm...@apache.org.
Minor cleanup to protobuf::parse.


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

Branch: refs/heads/master
Commit: 40ebceefd83bb86d7aaaf4eade918ee22b6e9ae0
Parents: 9632dd8
Author: Benjamin Mahler <be...@gmail.com>
Authored: Mon Jan 11 17:34:33 2016 -0800
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Mon Jan 11 17:34:43 2016 -0800

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/protobuf.hpp         | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/40ebceef/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
index 22cb5d9..017cef4 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
@@ -338,19 +338,9 @@ struct Parser : boost::static_visitor<Try<Nothing> >
         // variable information in order to construct a helpful
         // error message, e.g. "Failed to parse field 'a.b.c': ...".
         if (field->is_repeated()) {
-          Try<Nothing> parse =
-            internal::parse(reflection->AddMessage(message, field), object);
-
-          if (parse.isError()) {
-            return parse;
-          }
+          return parse(reflection->AddMessage(message, field), object);
         } else {
-          Try<Nothing> parse =
-            internal::parse(reflection->MutableMessage(message, field), object);
-
-          if (parse.isError()) {
-            return parse;
-          }
+          return parse(reflection->MutableMessage(message, field), object);
         }
         break;
       default: