You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/03/30 02:54:05 UTC

mesos git commit: Fix container destroy provisioning race.

Repository: mesos
Updated Branches:
  refs/heads/master 77fae968f -> c9eece94a


Fix container destroy provisioning race.

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


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

Branch: refs/heads/master
Commit: c9eece94a5d26502b26d8a90f0cdb52fa038ff6c
Parents: 77fae96
Author: Gilbert Song <so...@gmail.com>
Authored: Tue Mar 29 17:51:52 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Tue Mar 29 17:53:57 2016 -0700

----------------------------------------------------------------------
 src/slave/containerizer/mesos/containerizer.cpp | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c9eece94/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index ba713f0..a5dd223 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -754,11 +754,14 @@ Future<bool> MesosContainerizerProcess::_launch(
   CHECK(executorInfo.has_container());
   CHECK_EQ(executorInfo.container().type(), ContainerInfo::MESOS);
 
-  // This is because even if a 'destroy' happens after 'launch' and
-  // before '_launch', the 'destroy' will wait for the 'provision' in
-  // 'launch' to finish. Since we register the '_launch' callback
-  // first, it is guaranteed to be called before '__destroy'.
-  CHECK(containers_.contains(containerId));
+  // This is because if a 'destroy' happens after 'launch' and before
+  // '_launch', even if the '___destroy' will wait for the 'provision'
+  // in 'launch' to finish, there is still a chance that '___destroy'
+  // and its dependencies finish before '_launch' starts since onAny
+  // is not guaranteed to be executed in order.
+  if (!containers_.contains(containerId)) {
+    return Failure("Container has been destroyed");
+  }
 
   // Make sure containerizer is not in DESTROYING state, to avoid
   // a possible race that containerizer is destroying the container