You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2017/12/19 18:46:00 UTC

mesos git commit: Fixed flaky `ROOT_CGROUPS_RecoverLauncherOrphans` test.

Repository: mesos
Updated Branches:
  refs/heads/master 82979512b -> 0cc636b2d


Fixed flaky `ROOT_CGROUPS_RecoverLauncherOrphans` test.

Containerizer recovery returns control to the caller before completion
of destruction of orphaned containers. Previously, `wait` was called on
a container right after calling `recover`, so `wait` was almost always
successfull, because destruction of the orphaned container takes some
time to complete.

This patch replaces check for the container existence with the check
that a related freezer cgroup has been destroyed. The freezer cgroup
is destroyed during container destruction initiated by a containerizer
recovery process.

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


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

Branch: refs/heads/master
Commit: 0cc636b2d5ad5c934b8b7f350bc8c99b9282b5ab
Parents: 8297951
Author: Andrei Budnik <ab...@mesosphere.com>
Authored: Tue Dec 19 19:45:33 2017 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Tue Dec 19 19:45:33 2017 +0100

----------------------------------------------------------------------
 .../containerizer/nested_mesos_containerizer_tests.cpp   | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/0cc636b2/src/tests/containerizer/nested_mesos_containerizer_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/nested_mesos_containerizer_tests.cpp b/src/tests/containerizer/nested_mesos_containerizer_tests.cpp
index 22bd995..92832e7 100644
--- a/src/tests/containerizer/nested_mesos_containerizer_tests.cpp
+++ b/src/tests/containerizer/nested_mesos_containerizer_tests.cpp
@@ -1890,15 +1890,20 @@ TEST_F(NestedMesosContainerizerTest, ROOT_CGROUPS_RecoverLauncherOrphans)
       buildPath(containerId, "mesos", JOIN));
 
   ASSERT_SOME(cgroups::create(freezerHierarchy.get(), cgroup, true));
+  ASSERT_SOME_TRUE(cgroups::exists(freezerHierarchy.get(), cgroup));
 
   SlaveState state;
   state.id = SlaveID();
 
   AWAIT_READY(containerizer->recover(state));
 
-  Future<Option<ContainerTermination>> wait = containerizer->wait(containerId);
-  AWAIT_READY(wait);
-  ASSERT_SOME(wait.get());
+  // We expect that containerizer recovery will detect orphan container and
+  // will destroy it, so we check here that the freezer cgroup is destroyed.
+  //
+  // NOTE: `wait()` can return `Some` or `None` due to a race condition between
+  // `recover()` and `______destroy()` for an orphan container.
+  AWAIT_READY(containerizer->wait(containerId));
+  ASSERT_SOME_FALSE(cgroups::exists(freezerHierarchy.get(), cgroup));
 
   Future<hashset<ContainerID>> containers = containerizer->containers();
   AWAIT_READY(containers);