Commit c26f454c authored by Yuwei Huang's avatar Yuwei Huang Committed by Commit Bot

[remoting][FTL] Host Tarchycardia Prevention

crrev.com/c/1604427 removed the result field from the heartbeat reponse
and made set_interval_seconds take its field. However, the server side
change didn't take effect on time so the host still sees the 'SUCCESS'
result and interprets it as a 1s heartbeat delay, which is too frequent
and thus a "tarchycardia".

This CL prevents future host tarchycardia by enforcing a minimum
heartbeat interval on the host.

Bug: 954695
Change-Id: I87b3a52bafa17dd46246b4f488e4478d7884e91f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1610852Reviewed-by: default avatarJoe Downing <joedow@chromium.org>
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659260}
parent 1c63176f
......@@ -30,8 +30,8 @@ namespace remoting {
namespace {
constexpr base::TimeDelta kDefaultHeartbeatInterval =
base::TimeDelta::FromMinutes(5);
constexpr base::TimeDelta kMinimumHeartbeatInterval =
base::TimeDelta::FromMinutes(3);
constexpr base::TimeDelta kHeartbeatResponseTimeout =
base::TimeDelta::FromSeconds(30);
constexpr base::TimeDelta kWaitForAllStrategiesConnectedTimeout =
......@@ -273,10 +273,11 @@ void HeartbeatSender::OnResponse(const grpc::Status& status,
switch (status.error_code()) {
case grpc::StatusCode::OK:
delay = base::TimeDelta::FromSeconds(response.set_interval_seconds());
if (delay.is_zero()) {
LOG(WARNING)
<< "set_interval_seconds is not set. Using default interval.";
delay = kDefaultHeartbeatInterval;
if (delay < kMinimumHeartbeatInterval) {
LOG(WARNING) << "Received suspicious set_interval_seconds: " << delay
<< ". Using minimum interval: "
<< kMinimumHeartbeatInterval;
delay = kMinimumHeartbeatInterval;
}
break;
case grpc::StatusCode::NOT_FOUND:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment