Repository: mesos Updated Branches: refs/heads/1.4.x 9de550341 -> 5a51deb2f
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/5a51deb2 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5a51deb2 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5a51deb2 Branch: refs/heads/1.4.x Commit: 5a51deb2f9a2f8b1a2cf8f6cef4977e24a894ad6 Parents: f8b8ab9 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:54:44 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/5a51deb2/src/slave/containerizer/mesos/containerizer.cpp ---------------------------------------------------------------------- diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp index 417507f..5f29fe1 100644 --- a/src/slave/containerizer/mesos/containerizer.cpp +++ b/src/slave/containerizer/mesos/containerizer.cpp @@ -1952,7 +1952,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); } @@ -2149,7 +2154,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; }); } @@ -2173,7 +2183,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; }); }