Repository: mesos
Updated Branches:
  refs/heads/1.2.x 928751aa3 -> 55c26c27f


Used 'undiscardable' to protect a future in MesosContainerizer.

This patch addressed MESOS-7926 by protecting 'termination.future()'
with 'undiscardable'. This prevented the upstream discard event from
being propagated into 'termination.future()' which gets reused for
other calls.

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


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

Branch: refs/heads/1.2.x
Commit: 2fddf7160f28c1a3639670e728fab9c3ce566415
Parents: dfc0f85
Author: Jie Yu <yujie....@gmail.com>
Authored: Wed Aug 30 17:28:05 2017 -0700
Committer: Jie Yu <yujie....@gmail.com>
Committed: Thu Aug 31 19:55:14 2017 -0700

----------------------------------------------------------------------
 src/slave/containerizer/mesos/containerizer.cpp | 21 +++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2fddf716/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp 
b/src/slave/containerizer/mesos/containerizer.cpp
index 5c4e625..369c546 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -1922,7 +1922,12 @@ Future<Option<ContainerTermination>> 
MesosContainerizerProcess::wait(
     return None();
   }
 
-  return containers_.at(containerId)->termination.future()
+  // NOTE: Use 'undiscardable' here to make sure discard from the
+  // caller does not propagate into 'termination.future()' which will
+  // be used in 'destroy()'. We don't want a discard on 'wait()' call
+  // to affect future calls to 'destroy()'. See more details in
+  // MESOS-7926.
+  return undiscardable(containers_.at(containerId)->termination.future())
     .then(Option<ContainerTermination>::some);
 }
 
@@ -2119,7 +2124,12 @@ Future<bool> MesosContainerizerProcess::destroy(
   const Owned<Container>& container = containers_.at(containerId);
 
   if (container->state == DESTROYING) {
-    return container->termination.future()
+    // NOTE: Use 'undiscardable' here to make sure discard from the
+    // caller does not propagate into 'termination.future()' which
+    // will be used in 'wait()'. We don't want a discard on
+    // 'destroy()' call to affect future calls to 'wait()'. See more
+    // details in MESOS-7926.
+    return undiscardable(container->termination.future())
       .then([]() { return true; });
   }
 
@@ -2143,7 +2153,12 @@ Future<bool> MesosContainerizerProcess::destroy(
       return Nothing();
     }));
 
-  return container->termination.future()
+  // NOTE: Use 'undiscardable' here to make sure discard from the
+  // caller does not propagate into 'termination.future()' which will
+  // be used in 'wait()'. We don't want a discard on 'destroy()' call
+  // to affect future calls to 'wait()'. See more details in
+  // MESOS-7926.
+  return undiscardable(container->termination.future())
     .then([]() { return true; });
 }
 

Reply via email to