You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by nn...@apache.org on 2014/07/14 20:33:02 UTC
git commit: Fixed health check command subprocess handling.
Repository: mesos
Updated Branches:
refs/heads/master d94f08892 -> 1239e6cc3
Fixed health check command subprocess handling.
Currently it doesn't check all subprocess future states, and also
creates a pipe to stdin which can cause some scripts to expect stdin
input and blocks.
Review: https://reviews.apache.org/r/23416
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/1239e6cc
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/1239e6cc
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/1239e6cc
Branch: refs/heads/master
Commit: 1239e6cc36494ea56e00ad5720abd85bd6f2a4ac
Parents: d94f088
Author: Timothy Chen <tn...@apache.org>
Authored: Mon Jul 14 10:46:58 2014 -0700
Committer: Niklas Q. Nielsen <ni...@mesosphere.io>
Committed: Mon Jul 14 10:47:12 2014 -0700
----------------------------------------------------------------------
src/health-check/main.cpp | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/1239e6cc/src/health-check/main.cpp
----------------------------------------------------------------------
diff --git a/src/health-check/main.cpp b/src/health-check/main.cpp
index 707810a..95d881e 100644
--- a/src/health-check/main.cpp
+++ b/src/health-check/main.cpp
@@ -151,7 +151,11 @@ private:
Try<Subprocess> external =
process::subprocess(
command.value(),
- Subprocess::PIPE(),
+ // Reading from STDIN instead of PIPE because scripts
+ // seeing an open STDIN pipe might behave differently
+ // and we do not expect to pass any value from STDIN
+ // or PIPE.
+ Subprocess::FD(STDIN_FILENO),
Subprocess::FD(STDERR_FILENO),
Subprocess::FD(STDERR_FILENO),
environment);
@@ -162,9 +166,18 @@ private:
Future<Option<int> > status = external.get().status();
status.await(Seconds(check.timeout_seconds()));
- if (status.isFailed()) {
- promise.fail("Shell command check failed with status: " +
- status.failure());
+ if (!status.isReady()) {
+ string msg = "Shell command check failed with reason: ";
+ if (status.isFailed()) {
+ msg += "failed with error: " + status.failure();
+ } else if (status.isDiscarded()) {
+ msg += "status future discarded";
+ } else {
+ msg += "status still pending after timeout " +
+ stringify(Seconds(check.timeout_seconds()));
+ }
+
+ promise.fail(msg);
return;
}