MCPcopy Create free account
hub / github.com/apache/mesos / _httpCheck

Method _httpCheck

src/checks/checker_process.cpp:1033–1090  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1031
1032
1033Future<int> CheckerProcess::_httpCheck(
1034 const vector<string>& cmdArgv,
1035 const Option<runtime::Plain>& plain)
1036{
1037 VLOG(1) << "Launching " << name << " with command '"
1038 << strings::join(" ", cmdArgv) << "' for task '" << taskId << "'";
1039
1040 // TODO(alexr): Consider launching the helper binary once per task lifetime,
1041 // see MESOS-6766.
1042 Try<Subprocess> s = process::subprocess(
1043 cmdArgv[0],
1044 cmdArgv,
1045 Subprocess::PATH(os::DEV_NULL),
1046 Subprocess::PIPE(),
1047 Subprocess::PIPE(),
1048 nullptr,
1049 None(),
1050 getCustomCloneFunc(plain));
1051
1052 if (s.isError()) {
1053 return Failure(
1054 "Failed to create the " + string(HTTP_CHECK_COMMAND) +
1055 " subprocess: " + s.error());
1056 }
1057
1058 // TODO(alexr): Use lambda named captures for
1059 // these cached values once it is available.
1060 const pid_t curlPid = s->pid();
1061 const string _name = name;
1062 const Duration timeout = checkTimeout;
1063 const TaskID _taskId = taskId;
1064
1065 return await(
1066 s->status(),
1067 process::io::read(s->out().get()),
1068 process::io::read(s->err().get()))
1069 .after(
1070 timeout,
1071 [timeout, curlPid, _name, _taskId](Future<tuple<Future<Option<int>>,
1072 Future<string>,
1073 Future<string>>> future)
1074 {
1075 future.discard();
1076
1077 if (curlPid != -1) {
1078 // Cleanup the HTTP_CHECK_COMMAND process.
1079 VLOG(1) << "Killing the " << _name << " process " << curlPid
1080 << " for task '" << _taskId << "'";
1081
1082 os::killtree(curlPid, SIGKILL);
1083 }
1084
1085 return Failure(
1086 string(HTTP_CHECK_COMMAND) + " timed out after " +
1087 stringify(timeout));
1088 })
1089 .then(defer(self(), &Self::__httpCheck, lambda::_1));
1090}

Callers

nothing calls this directly

Calls 15

NoneClass · 0.85
getCustomCloneFuncFunction · 0.85
FailureClass · 0.85
deferFunction · 0.85
afterMethod · 0.80
outMethod · 0.80
errMethod · 0.80
errorMethod · 0.65
joinFunction · 0.50
subprocessFunction · 0.50
awaitFunction · 0.50
readFunction · 0.50

Tested by

no test coverage detected