Repository: mesos
Updated Branches:
  refs/heads/master d72c11cf9 -> 88db77f26


Added command logging for processes running in slave's cgroup.

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


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

Branch: refs/heads/master
Commit: 2b5e5b4c399174c8890727344b0acb9b8da5d6d3
Parents: d72c11c
Author: Jie Yu <[email protected]>
Authored: Wed Apr 1 13:05:15 2015 -0700
Committer: Jie Yu <[email protected]>
Committed: Thu Apr 2 11:54:03 2015 -0700

----------------------------------------------------------------------
 src/slave/slave.cpp | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2b5e5b4c/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 0f70eba..521624c 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -245,10 +245,24 @@ void Slave::initialize()
       // possibly automatically killing any running processes and
       // moving this code to during recovery.
       if (!processes.get().empty()) {
+        // For each process, we print its pid as well as its command
+        // to help triaging.
+        vector<string> infos;
+        foreach (pid_t pid, processes.get()) {
+          Result<os::Process> proc = os::process(pid);
+
+          // Only print the command if available.
+          if (proc.isSome()) {
+            infos.push_back(stringify(pid) + " '" + proc.get().command + "'");
+          } else {
+            infos.push_back(stringify(pid));
+          }
+        }
+
         EXIT(1) << "A slave (or child process) is still running, "
-                << "please check the process(es) '"
-                << stringify(processes.get()) << "' listed in "
-                << path::join(hierarchy.get(), cgroup, "cgroups.proc");
+                << "please check the following process(es) listed in "
+                << path::join(hierarchy.get(), cgroup, "cgroups.proc")
+                << ":\n" << strings::join("\n", infos);
       }
 
       // Move all of our threads into the cgroup.

Reply via email to