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/08/21 17:44:10 UTC
mesos git commit: Allowed clean up unknown containers in cgroups
isolator.
Repository: mesos
Updated Branches:
refs/heads/master bb047cd72 -> 883f88954
Allowed clean up unknown containers in cgroups isolator.
It's likely that isolator `cleanup` is called for an unknown container.
For instance, during launch of a container, `prepare` of some other
isolator failed. Another scenario is that the operator changes the
isolation flags, causing `cleanup` to be called for an isolator that
recovers nothing. Therefore, we should ignore the cleanup if the
container is unknown. In any case, the `cleanup` won't be called
multiple times for an isolator.
Review: https://reviews.apache.org/r/51265/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/883f8895
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/883f8895
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/883f8895
Branch: refs/heads/master
Commit: 883f88954cbd958e64b5e402fd439f27cabbe3f8
Parents: bb047cd
Author: haosdent huang <ha...@gmail.com>
Authored: Sun Aug 21 10:42:14 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Sun Aug 21 10:42:14 2016 -0700
----------------------------------------------------------------------
include/mesos/slave/isolator.hpp | 6 ++++++
src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp | 4 +++-
src/slave/containerizer/mesos/isolators/cgroups/subsystem.hpp | 4 ++++
.../mesos/isolators/cgroups/subsystems/devices.cpp | 5 ++++-
4 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/883f8895/include/mesos/slave/isolator.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/slave/isolator.hpp b/include/mesos/slave/isolator.hpp
index b90974e..ea1fa4f 100644
--- a/include/mesos/slave/isolator.hpp
+++ b/include/mesos/slave/isolator.hpp
@@ -107,6 +107,12 @@ public:
// Clean up a terminated container. This is called after the
// executor and all processes in the container have terminated.
+ // It's likely that isolator `cleanup` is called for an unknown
+ // container (see MESOS-6059). Therefore, the isolator should ignore
+ // the cleanup is the container is unknown to it. In any case, the
+ // `cleanup` won't be called multiple times for a container. Also,
+ // if `prepare` is called, the cleanup is guaranteed to be called
+ // after `prepare` finishes (or fails).
virtual process::Future<Nothing> cleanup(
const ContainerID& containerId)
{
http://git-wip-us.apache.org/repos/asf/mesos/blob/883f8895/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp b/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp
index 0c72452..4c0ec5c 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp
@@ -636,7 +636,9 @@ Future<Nothing> CgroupsIsolatorProcess::cleanup(
const ContainerID& containerId)
{
if (!infos.contains(containerId)) {
- return Failure("Unknown container");
+ VLOG(1) << "Ignoring cleanup request for unknown container " << containerId;
+
+ return Nothing();
}
list<Future<Nothing>> cleanups;
http://git-wip-us.apache.org/repos/asf/mesos/blob/883f8895/src/slave/containerizer/mesos/isolators/cgroups/subsystem.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/cgroups/subsystem.hpp b/src/slave/containerizer/mesos/isolators/cgroups/subsystem.hpp
index 06f4400..18ba445 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups/subsystem.hpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups/subsystem.hpp
@@ -126,6 +126,10 @@ public:
/**
* Clean up the cgroups subsystem for the associated container. It
* will be called when destruction to ensure everyting be cleanup.
+ * Similar to the isolator `cleanup`, it's likely that the `cleanup`
+ * for the subsystem is called for unknown containers (see
+ * MESOS-6059). We should ignore the cleanup request if the
+ * container is unknown to the subsystem.
*
* @param containerId The target containerId.
* @return Nothing or an error if `cleanup` fails.
http://git-wip-us.apache.org/repos/asf/mesos/blob/883f8895/src/slave/containerizer/mesos/isolators/cgroups/subsystems/devices.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/cgroups/subsystems/devices.cpp b/src/slave/containerizer/mesos/isolators/cgroups/subsystems/devices.cpp
index 3b25df2..0afc248 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups/subsystems/devices.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups/subsystems/devices.cpp
@@ -151,7 +151,10 @@ Future<Nothing> DevicesSubsystem::prepare(const ContainerID& containerId)
Future<Nothing> DevicesSubsystem::cleanup(const ContainerID& containerId)
{
if (!containerIds.contains(containerId)) {
- return Failure("Unknown container");
+ VLOG(1) << "Ignoring cleanup subsystem '" << name() << "' "
+ << "for unknown container " << containerId;
+
+ return Nothing();
}
containerIds.erase(containerId);