You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ya...@apache.org on 2016/10/28 18:02:23 UTC

[2/2] mesos git commit: Fixed master that leaks empty entries in its hashmaps.

Fixed master that leaks empty entries in its hashmaps.

This fixes the CHECK failure mentioned in MESOS-6482.

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


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

Branch: refs/heads/1.1.x
Commit: 55322e7a206618e04109f462986c6a550afbd352
Parents: b18c5cc
Author: Jiang Yan Xu <xu...@apple.com>
Authored: Thu Oct 27 13:30:24 2016 -0700
Committer: Jiang Yan Xu <xu...@apple.com>
Committed: Fri Oct 28 11:01:50 2016 -0700

----------------------------------------------------------------------
 src/master/master.cpp | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/55322e7a/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index bb61827..b57dd13 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -2462,12 +2462,17 @@ void Master::_subscribe(
 
     // Add active tasks and executors to the framework.
     foreachvalue (Slave* slave, slaves.registered) {
-      foreachvalue (Task* task, slave->tasks[framework->id()]) {
-        framework->addTask(task);
+      if (slave->tasks.contains(framework->id())) {
+        foreachvalue (Task* task, slave->tasks.at(framework->id())) {
+          framework->addTask(task);
+        }
       }
-      foreachvalue (const ExecutorInfo& executor,
-                    slave->executors[framework->id()]) {
-        framework->addExecutor(slave->id, executor);
+
+      if (slave->executors.contains(framework->id())) {
+        foreachvalue (const ExecutorInfo& executor,
+                      slave->executors.at(framework->id())) {
+          framework->addExecutor(slave->id, executor);
+        }
       }
     }
 
@@ -2800,12 +2805,17 @@ void Master::_subscribe(
 
     // Add active tasks and executors to the framework.
     foreachvalue (Slave* slave, slaves.registered) {
-      foreachvalue (Task* task, slave->tasks[framework->id()]) {
-        framework->addTask(task);
+      if (slave->tasks.contains(framework->id())) {
+        foreachvalue (Task* task, slave->tasks.at(framework->id())) {
+          framework->addTask(task);
+        }
       }
-      foreachvalue (const ExecutorInfo& executor,
-                    slave->executors[framework->id()]) {
-        framework->addExecutor(slave->id, executor);
+
+      if (slave->executors.contains(framework->id())) {
+        foreachvalue (const ExecutorInfo& executor,
+                      slave->executors.at(framework->id())) {
+          framework->addExecutor(slave->id, executor);
+        }
       }
     }