You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2014/05/24 00:35:53 UTC

git commit: Fixed ExternalContainerizer wait behavior when getting destroyed.

Repository: mesos
Updated Branches:
  refs/heads/master cbaa94c96 -> 8dd84178d


Fixed ExternalContainerizer wait behavior when getting destroyed.

When 'wait' was terminated by 'destroy', it is getting SIGKILLed. We
need to test for that specific case and setup the appropriate
Termination message accordingly as it can not get delivered by the
external containerizer program itself.

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


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

Branch: refs/heads/master
Commit: 8dd84178db6eb494bdb37e98f07d061aa1a9f031
Parents: cbaa94c
Author: Till Toenshoff <to...@me.com>
Authored: Sat May 24 00:24:31 2014 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Sat May 24 00:24:31 2014 +0200

----------------------------------------------------------------------
 .../containerizer/external_containerizer.cpp    | 26 ++++++++++++++++++++
 1 file changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8dd84178/src/slave/containerizer/external_containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/external_containerizer.cpp b/src/slave/containerizer/external_containerizer.cpp
index a56653d..ac3dd18 100644
--- a/src/slave/containerizer/external_containerizer.cpp
+++ b/src/slave/containerizer/external_containerizer.cpp
@@ -579,14 +579,40 @@ void ExternalContainerizerProcess::__wait(
     return;
   }
 
+  // When 'wait' was terminated by 'destroy', it is getting SIGKILLed
+  // (see unwait). We need to test for that specific case as otherwise
+  // the result validation below will return an error due to a non 0
+  // exit status.
+  if (actives[containerId]->destroying && future.isReady()) {
+    Future<Option<int> > statusFuture = tuples::get<1>(future.get());
+    if (statusFuture.isReady()) {
+      Option<int> status = statusFuture.get();
+      if (status.isSome()) {
+        VLOG(2) << "Wait got destroyed on '" << containerId << "'";
+        containerizer::Termination termination;
+        // 'killed' must only be true when a resource limitation
+        // had to be enforced through terminating a task.
+        // TODO(tillt): Consider renaming 'killed' towards 'limited'.
+        termination.set_killed(false);
+        termination.set_message("");
+        termination.set_status(status.get());
+        actives[containerId]->termination.set(termination);
+        cleanup(containerId);
+        return;
+      }
+    }
+  }
+
   Try<containerizer::Termination> termination =
     result<containerizer::Termination>(future);
 
   if (termination.isError()) {
+    VLOG(2) << "Wait termination failed on '" << containerId << "'";
     // 'wait' has failed, we need to tear down everything now.
     actives[containerId]->termination.fail(termination.error());
     unwait(containerId);
   } else {
+    VLOG(2) << "Wait Termination: " << termination.get().DebugString();
     // Set the promise to alert others waiting on this container.
     actives[containerId]->termination.set(termination.get());
   }