This is an automated email from the ASF dual-hosted git repository. josephwu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 7d99c721fbd4fa546b24ee81dfc9c711a5c824ba Author: Joseph Wu <[email protected]> AuthorDate: Wed Apr 10 16:39:08 2019 -0700 Special cased HEARTBEAT call handling in agent. This silences a '400 Bad Request' response by the agent whenever an executor sends a HEARTBEAT call. These HEARTBEATs do not include a valid value for required fields (FrameworkID and ExecutorID) because they are not known by the library generating the HEARTBEATs. The error is harmless because HEARTBEAT calls do not have any effect besides generating traffic. Review: https://reviews.apache.org/r/70450 --- src/executor/executor.cpp | 3 +++ src/slave/http.cpp | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/executor/executor.cpp b/src/executor/executor.cpp index e9439da..664a2f1 100644 --- a/src/executor/executor.cpp +++ b/src/executor/executor.cpp @@ -792,6 +792,9 @@ protected: if (connections.isSome()) { Call call; call.set_type(Call::HEARTBEAT); + + // TODO(josephw): Consider exposing the actual values to the executor + // library and inserting them below. call.mutable_executor_id()->set_value("unused"); call.mutable_framework_id()->set_value("unused"); diff --git a/src/slave/http.cpp b/src/slave/http.cpp index d66ae52..2c4e792 100644 --- a/src/slave/http.cpp +++ b/src/slave/http.cpp @@ -789,6 +789,12 @@ Future<Response> Http::executor( string("Expecting 'Accept' to allow ") + "'" + APPLICATION_PROTOBUF + "' or '" + APPLICATION_JSON + "'"); } + } else if (call.type() == executor::Call::HEARTBEAT) { + // We return early here before doing any validation because currently + // this proto may contain dummy values for framework and executor IDs + // (which is safe). + // See: TODO inside `heartbeat()` in src/executor/executor.cpp. + return Accepted(); } else { if (slave->state == Slave::RECOVERING) { return ServiceUnavailable("Agent has not finished recovery"); @@ -864,7 +870,8 @@ Future<Response> Http::executor( } case executor::Call::HEARTBEAT: { - return Accepted(); + // This should be handled before hitting this switch statement. + UNREACHABLE(); } case executor::Call::UNKNOWN: {
