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/ecd0dd85 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ecd0dd85 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ecd0dd85 Branch: refs/heads/1.4.x Commit: ecd0dd85e383d789104896b55c38fb9837866ab3 Parents: 4faa7f4 Author: Akash Gupta <[email protected]> Authored: Sun Feb 25 13:37:42 2018 -0800 Committer: Gilbert Song <[email protected]> Committed: Fri Mar 2 16:55:50 2018 -0800 ---------------------------------------------------------------------- src/docker/executor.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/ecd0dd85/src/docker/executor.cpp ---------------------------------------------------------------------- diff --git a/src/docker/executor.cpp b/src/docker/executor.cpp index 2c538ce..e580a48 100644 --- a/src/docker/executor.cpp +++ b/src/docker/executor.cpp @@ -253,6 +253,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) { @@ -286,6 +293,7 @@ public: &Self::reapedContainer, None()); } +#endif // __WINDOWS__ return Nothing(); }));
