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/04/23 00:26:12 UTC

[1/2] mesos git commit: Fixed a mesos containerizer race destroy while preparing.

Repository: mesos
Updated Branches:
  refs/heads/master 3836da707 -> 653eca74f


Fixed a mesos containerizer race destroy while preparing.

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


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

Branch: refs/heads/master
Commit: 3a5dcfe8b13aeffd4f18760aac3df824414685db
Parents: 3836da7
Author: Gilbert Song <so...@gmail.com>
Authored: Fri Apr 22 15:26:00 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Fri Apr 22 15:26:00 2016 -0700

----------------------------------------------------------------------
 src/slave/containerizer/mesos/containerizer.cpp | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3a5dcfe8/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index 1e1a369..e92b9b5 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -892,7 +892,22 @@ Future<list<Option<ContainerLaunchInfo>>> MesosContainerizerProcess::prepare(
     const Option<string>& user,
     const Option<ProvisionInfo>& provisionInfo)
 {
-  CHECK(containers_.contains(containerId));
+  // This is because if a 'destroy' happens during the provisoiner is
+  // provisioning in '_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
+  // 'prepare' 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
+  // while it is preparing isolators for the container.
+  if (containers_[containerId]->state == DESTROYING) {
+    return Failure("Container is currently being destroyed");
+  }
 
   containers_[containerId]->state = PREPARING;
 


[2/2] mesos git commit: Fixed isolator cleaup issue when destroying a provisioning container.

Posted by ji...@apache.org.
Fixed isolator cleaup issue when destroying a provisioning container.

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


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

Branch: refs/heads/master
Commit: 653eca74f1080f5f55cd5092423506163e65d402
Parents: 3a5dcfe
Author: Gilbert Song <so...@gmail.com>
Authored: Fri Apr 22 15:26:04 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Fri Apr 22 15:26:04 2016 -0700

----------------------------------------------------------------------
 src/slave/containerizer/mesos/containerizer.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/653eca74/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index e92b9b5..133c0fe 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -1486,9 +1486,10 @@ void MesosContainerizerProcess::destroy(
     await(container->provisionInfos)
       .onAny(defer(
           self(),
-          &Self::___destroy,
+          &Self::____destroy,
           containerId,
           None(),
+          list<Future<Nothing>>(),
           "Container destroyed while provisioning images"));
 
     return;