Repository: mesos Updated Branches: refs/heads/master 8da1f0e61 -> 2e96672b5
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/2e96672b Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2e96672b Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2e96672b Branch: refs/heads/master Commit: 2e96672b55a17c49f5228d8629f799fca4df0fdb Parents: 8da1f0e 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:52: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/2e96672b/src/slave/containerizer/mesos/containerizer.cpp ---------------------------------------------------------------------- diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp index 5f9373a..4ff014e 100644 --- a/src/slave/containerizer/mesos/containerizer.cpp +++ b/src/slave/containerizer/mesos/containerizer.cpp @@ -1989,7 +1989,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); } @@ -2186,7 +2191,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; }); } @@ -2210,7 +2220,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; }); }