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 2017/07/14 21:43:31 UTC

mesos git commit: Preventing agent recovery failing from unsuccessful `docker rm`.

Repository: mesos
Updated Branches:
  refs/heads/master 5645fddf0 -> d4d75d32d


Preventing agent recovery failing from unsuccessful `docker rm`.

This patch changes the semancits of `Docker::stop()` to do a best-effort
`docker rm` and log the error instead of returning the failure, as a
workaround of the mount namespace leakage issue in Docker 1.12/1.13.

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


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

Branch: refs/heads/master
Commit: d4d75d32de8280eaa75fecd64b6c67db07299a5a
Parents: 5645fdd
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
Authored: Fri Jul 14 13:57:24 2017 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Fri Jul 14 13:57:24 2017 -0700

----------------------------------------------------------------------
 src/docker/docker.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d4d75d32/src/docker/docker.cpp
----------------------------------------------------------------------
diff --git a/src/docker/docker.cpp b/src/docker/docker.cpp
index 8ca0c68..8081c02 100755
--- a/src/docker/docker.cpp
+++ b/src/docker/docker.cpp
@@ -933,7 +933,10 @@ Future<Option<int>> Docker::run(
   return s->status();
 }
 
-
+// NOTE: A known issue in Docker 1.12/1.13 sometimes leaks its mount
+// namespace, causing `docker rm` to fail. As a workaround, we do a
+// best-effort `docker rm` and log the error insteaf of return a
+// failure when `remove` is set to true (MESOS-7777).
 Future<Nothing> Docker::stop(
     const string& containerName,
     const Duration& timeout,
@@ -982,7 +985,12 @@ Future<Nothing> Docker::_stop(
 
   if (remove) {
     bool force = !status.isSome() || status.get() != 0;
-    return docker.rm(containerName, force);
+    return docker.rm(containerName, force)
+      .repair([=](const Future<Nothing>& future) {
+        LOG(ERROR) << "Unable to remove Docker container '"
+                   << containerName + "': " << future.failure();
+        return Nothing();
+      });
   }
 
   return checkError(cmd, s);