You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ka...@apache.org on 2017/09/13 19:32:44 UTC

[2/3] mesos git commit: Ignored cgroups v2 hierarchy when parsing /proc/self/cgroups.

Ignored cgroups v2 hierarchy when parsing /proc/self/cgroups.

Cgroups v2 hierarchies don't list the "controllers" field (e.g.,
"0::/user.slice/user-1000.slice/session-5.scope) is empty and hence
the cgroup parser failes. We should simply skip over fields with empty
controller field.

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


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

Branch: refs/heads/1.3.x
Commit: 2b3f7b051b644441c307e50983a45cbd79ce58c8
Parents: 5068b21
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Wed Sep 13 15:24:15 2017 -0400
Committer: Kapil Arya <ka...@mesosphere.io>
Committed: Wed Sep 13 15:28:26 2017 -0400

----------------------------------------------------------------------
 src/linux/cgroups.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2b3f7b05/src/linux/cgroups.cpp
----------------------------------------------------------------------
diff --git a/src/linux/cgroups.cpp b/src/linux/cgroups.cpp
index 334005a..17a5770 100644
--- a/src/linux/cgroups.cpp
+++ b/src/linux/cgroups.cpp
@@ -1908,7 +1908,10 @@ Result<string> cgroup(pid_t pid, const string& subsystem)
   foreach (const string& line, strings::tokenize(read.get(), "\n")) {
     vector<string> tokens = strings::tokenize(line, ":");
 
-    if (tokens.size() != 3) {
+    // The second field is empty for cgroups v2 hierarchy.
+    if (tokens.size() == 2) {
+      continue;
+    } else if (tokens.size() != 3) {
       return Error("Unexpected format in " + path);
     }