Windows: Fixed flaky Docker command health check test. The `DockerContainerizerHealthCheckTest.ROOT_DOCKER_ DockerHealthStatusChange` test was flaky on Windows, because the Docker executor manually reaps the container exit code in case that `docker run` fails to get the exit code. This logic doesn't work on Windows, since the process might not be visible to the container host machine, causing `TASK_FAILED` to get sent. By removing the reaping logic on Windows, the test is much more reliable.
Review: https://reviews.apache.org/r/65733/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e524ac33 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e524ac33 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e524ac33 Branch: refs/heads/1.5.x Commit: e524ac337b6fb53c6754f3f1636df720f81f96b0 Parents: a56b182 Author: Akash Gupta <[email protected]> Authored: Sun Feb 25 13:37:42 2018 -0800 Committer: Gilbert Song <[email protected]> Committed: Wed Mar 7 01:08:12 2018 -0800 ---------------------------------------------------------------------- src/docker/executor.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/e524ac33/src/docker/executor.cpp ---------------------------------------------------------------------- diff --git a/src/docker/executor.cpp b/src/docker/executor.cpp index 80e2d81..ea47b44 100644 --- a/src/docker/executor.cpp +++ b/src/docker/executor.cpp @@ -277,6 +277,13 @@ public: // executor never returning although the container has already exited. // To workaround this issue, here we reap the container process directly // so we will be notified when the container exits. + // + // The issue has only been reported on Linux, so it's not clear if + // Windows also has this issue. Regardless, we don't use this workaround + // for Windows, because the pid legitimately might not exist. For + // example, if the container is running in Hyper-V isolation, the pid + // will only exist in the guest OS. +#ifndef __WINDOWS__ if (container.pid.isSome()) { process::reap(container.pid.get()) .then(defer(self(), [=](const Option<int>& status) { @@ -310,6 +317,7 @@ public: &Self::reapedContainer, None()); } +#endif // __WINDOWS__ return Nothing(); }));
