Merge pull request #20577 from soheilhy/fix-benchmark-flaky-2

Consider "Socket closed" to be a good status
reviewable/pr20582/r1
Soheil Hassas Yeganeh 5 years ago committed by GitHub
commit 98abc22f4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      test/cpp/qps/driver.cc

@ -118,6 +118,20 @@ static double ServerIdleCpuTime(const ServerStats& s) {
}
static int Cores(int n) { return n; }
static bool IsSuccess(const Status& s) {
if (s.ok()) return true;
// Since we shutdown servers and clients at the same time, they both can
// observe cancellation. Thus, we consider CANCELLED as good status.
if (static_cast<StatusCode>(s.error_code()) == StatusCode::CANCELLED) {
return true;
}
// Since we shutdown servers and clients at the same time, server can close
// the socket before the client attempts to do that, and vice versa. Thus
// receiving a "Socket closed" error is fine.
if (s.error_message() == "Socket closed") return true;
return false;
}
// Postprocess ScenarioResult and populate result summary.
static void postprocess_scenario_result(ScenarioResult* result) {
Histogram histogram;
@ -498,8 +512,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
// Since we shutdown servers and clients at the same time, clients can
// observe cancellation. Thus, we consider both OK and CANCELLED as good
// status.
const bool success = s.ok() || static_cast<StatusCode>(s.error_code()) ==
StatusCode::CANCELLED;
const bool success = IsSuccess(s);
result->add_client_success(success);
if (!success) {
gpr_log(GPR_ERROR, "Client %zu had an error %s", i,
@ -534,8 +547,7 @@ std::unique_ptr<ScenarioResult> RunScenario(
// Since we shutdown servers and clients at the same time, servers can
// observe cancellation. Thus, we consider both OK and CANCELLED as good
// status.
const bool success = s.ok() || static_cast<StatusCode>(s.error_code()) ==
StatusCode::CANCELLED;
const bool success = IsSuccess(s);
result->add_server_success(success);
if (!success) {
gpr_log(GPR_ERROR, "Server %zu had an error %s", i,

Loading…
Cancel
Save