You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by zh...@apache.org on 2018/08/10 17:57:02 UTC
[mesos] 01/02: Replaced `cgroups::DESTROY_TIMEOUT` with new agent
flag.
This is an automated email from the ASF dual-hosted git repository.
zhitao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit c57fe98aba809bc415910730a800f534be1ce213
Author: Zhitao Li <zh...@gmail.com>
AuthorDate: Fri Jul 27 11:00:52 2018 -0700
Replaced `cgroups::DESTROY_TIMEOUT` with new agent flag.
The new agent flag can be used to reconfigure how long a container
destroy is allowed to take on Mesos containerizer.
Review: https://reviews.apache.org/r/68088
---
src/linux/cgroups.hpp | 6 ------
src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp | 2 +-
src/slave/containerizer/mesos/linux_launcher.cpp | 4 ++--
src/slave/flags.cpp | 7 +++++++
src/slave/flags.hpp | 1 +
5 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/linux/cgroups.hpp b/src/linux/cgroups.hpp
index 6a6f0e6..282b8e7 100644
--- a/src/linux/cgroups.hpp
+++ b/src/linux/cgroups.hpp
@@ -38,12 +38,6 @@
namespace cgroups {
-// Suggested timeout for use with the convenience version of
-// cgroups::destroy(); it is not a default timeout and must be
-// explicitly specified.
-const Duration DESTROY_TIMEOUT = Seconds(60);
-
-
// Freezing a cgroup may get stuck (see MESOS-1689 for details). To
// workaround, we may want to thaw the cgroup and retry freezing it.
// This is the suggested retry interval.
diff --git a/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp b/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp
index e016d6d..1444c05 100644
--- a/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp
+++ b/src/slave/containerizer/mesos/isolators/cgroups/cgroups.cpp
@@ -1007,7 +1007,7 @@ Future<Nothing> CgroupsIsolatorProcess::_cleanup(
destroys.push_back(cgroups::destroy(
hierarchy,
infos[containerId]->cgroup,
- cgroups::DESTROY_TIMEOUT));
+ flags.cgroups_destroy_timeout));
break;
}
diff --git a/src/slave/containerizer/mesos/linux_launcher.cpp b/src/slave/containerizer/mesos/linux_launcher.cpp
index cd677cc..d1f8d3f 100644
--- a/src/slave/containerizer/mesos/linux_launcher.cpp
+++ b/src/slave/containerizer/mesos/linux_launcher.cpp
@@ -637,7 +637,7 @@ Future<Nothing> LinuxLauncherProcess::destroy(const ContainerID& containerId)
return cgroups::destroy(
freezerHierarchy,
cgroup,
- cgroups::DESTROY_TIMEOUT)
+ flags.cgroups_destroy_timeout)
.then(defer(
self(),
&LinuxLauncherProcess::_destroy,
@@ -669,7 +669,7 @@ Future<Nothing> LinuxLauncherProcess::_destroy(const ContainerID& containerId)
return cgroups::destroy(
systemdHierarchy.get(),
cgroup,
- cgroups::DESTROY_TIMEOUT);
+ flags.cgroups_destroy_timeout);
}
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index 58cdc0f..54d9acc 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -533,6 +533,13 @@ mesos::internal::slave::Flags::Flags()
DEFAULT_MAX_COMPLETED_EXECUTORS_PER_FRAMEWORK);
#ifdef __linux__
+ add(&Flags::cgroups_destroy_timeout,
+ "cgroups_destroy_timeout",
+ "Amount of time allowed to destroy a cgroup hierarchy. If the cgroup\n"
+ "hierarchy is not destroyed within the timeout, the corresponding\n"
+ "container destroy is considered failed.",
+ Seconds(60));
+
add(&Flags::cgroups_hierarchy,
"cgroups_hierarchy",
"The path to the cgroups hierarchy root\n", "/sys/fs/cgroup");
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index eeb9708..88c35da 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -99,6 +99,7 @@ public:
bool strict;
Duration register_retry_interval_min;
#ifdef __linux__
+ Duration cgroups_destroy_timeout;
std::string cgroups_hierarchy;
std::string cgroups_root;
bool cgroups_enable_cfs;