From d45f877dfb3ac4ed5005983f2180da31bdc20f64 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 19 May 2020 11:37:26 -0700 Subject: [PATCH] Add more logs and asswert to qps_worker --- test/cpp/qps/driver.cc | 20 ++++++++++++++++++++ test/cpp/qps/qps_worker.cc | 11 +++++++++++ 2 files changed, 31 insertions(+) diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index f26c11c8dca..deac6c43cbe 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -326,6 +326,7 @@ std::unique_ptr RunScenario( if (server_config.core_limit() != 0) { gpr_log(GPR_ERROR, "server config core limit is set but ignored by driver"); + GPR_ASSERT(false); } ServerArgs args; @@ -333,10 +334,12 @@ std::unique_ptr RunScenario( servers[i].stream = servers[i].stub->RunServer(alloc_context(&contexts)); if (!servers[i].stream->Write(args)) { gpr_log(GPR_ERROR, "Could not write args to server %zu", i); + GPR_ASSERT(false); } ServerStatus init_status; if (!servers[i].stream->Read(&init_status)) { gpr_log(GPR_ERROR, "Server %zu did not yield initial status", i); + GPR_ASSERT(false); } if (qps_server_target_override.length() > 0) { // overriding the qps server target only works if there is 1 server @@ -383,6 +386,7 @@ std::unique_ptr RunScenario( if (initial_client_config.core_limit() != 0) { gpr_log(GPR_ERROR, "client config core limit set but ignored"); + GPR_ASSERT(false); } // Reduce channel count so that total channels specified is held regardless @@ -400,6 +404,7 @@ std::unique_ptr RunScenario( clients[i].stream = clients[i].stub->RunClient(alloc_context(&contexts)); if (!clients[i].stream->Write(args)) { gpr_log(GPR_ERROR, "Could not write args to client %zu", i); + GPR_ASSERT(false); } } @@ -407,6 +412,7 @@ std::unique_ptr RunScenario( ClientStatus init_status; if (!clients[i].stream->Read(&init_status)) { gpr_log(GPR_ERROR, "Client %zu did not yield initial status", i); + GPR_ASSERT(false); } } @@ -423,12 +429,14 @@ std::unique_ptr RunScenario( auto client = &clients[i]; if (!client->stream->Write(client_mark)) { gpr_log(GPR_ERROR, "Couldn't write mark to client %zu", i); + GPR_ASSERT(false); } } for (size_t i = 0; i < num_clients; i++) { auto client = &clients[i]; if (!client->stream->Read(&client_status)) { gpr_log(GPR_ERROR, "Couldn't get status from client %zu", i); + GPR_ASSERT(false); } } @@ -444,24 +452,28 @@ std::unique_ptr RunScenario( auto server = &servers[i]; if (!server->stream->Write(server_mark)) { gpr_log(GPR_ERROR, "Couldn't write mark to server %zu", i); + GPR_ASSERT(false); } } for (size_t i = 0; i < num_clients; i++) { auto client = &clients[i]; if (!client->stream->Write(client_mark)) { gpr_log(GPR_ERROR, "Couldn't write mark to client %zu", i); + GPR_ASSERT(false); } } for (size_t i = 0; i < num_servers; i++) { auto server = &servers[i]; if (!server->stream->Read(&server_status)) { gpr_log(GPR_ERROR, "Couldn't get status from server %zu", i); + GPR_ASSERT(false); } } for (size_t i = 0; i < num_clients; i++) { auto client = &clients[i]; if (!client->stream->Read(&client_status)) { gpr_log(GPR_ERROR, "Couldn't get status from client %zu", i); + GPR_ASSERT(false); } } @@ -485,9 +497,11 @@ std::unique_ptr RunScenario( auto client = &clients[i]; if (!client->stream->Write(client_mark)) { gpr_log(GPR_ERROR, "Couldn't write mark to client %zu", i); + GPR_ASSERT(false); } if (!client->stream->WritesDone()) { gpr_log(GPR_ERROR, "Failed WritesDone for client %zu", i); + GPR_ASSERT(false); } } gpr_log(GPR_INFO, "Finishing servers"); @@ -495,9 +509,11 @@ std::unique_ptr RunScenario( auto server = &servers[i]; if (!server->stream->Write(server_mark)) { gpr_log(GPR_ERROR, "Couldn't write mark to server %zu", i); + GPR_ASSERT(false); } if (!server->stream->WritesDone()) { gpr_log(GPR_ERROR, "Failed WritesDone for server %zu", i); + GPR_ASSERT(false); } } @@ -517,6 +533,7 @@ std::unique_ptr RunScenario( GPR_ASSERT(!client->stream->Read(&client_status)); } else { gpr_log(GPR_ERROR, "Couldn't get final status from client %zu", i); + GPR_ASSERT(false); } } for (size_t i = 0; i < num_clients; i++) { @@ -530,6 +547,7 @@ std::unique_ptr RunScenario( if (!success) { gpr_log(GPR_ERROR, "Client %zu had an error %s", i, s.error_message().c_str()); + GPR_ASSERT(false); } } @@ -552,6 +570,7 @@ std::unique_ptr RunScenario( GPR_ASSERT(!server->stream->Read(&server_status)); } else { gpr_log(GPR_ERROR, "Couldn't get final status from server %zu", i); + GPR_ASSERT(false); } } for (size_t i = 0; i < num_servers; i++) { @@ -565,6 +584,7 @@ std::unique_ptr RunScenario( if (!success) { gpr_log(GPR_ERROR, "Server %zu had an error %s", i, s.error_message().c_str()); + GPR_ASSERT(false); } } diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc index 8a725c03405..fd207765ca5 100644 --- a/test/cpp/qps/qps_worker.cc +++ b/test/cpp/qps/qps_worker.cc @@ -108,6 +108,7 @@ class WorkerServiceImpl final : public WorkerService::Service { Status RunClient( ServerContext* ctx, ServerReaderWriter* stream) override { + gpr_log(GPR_INFO, "RunClient: Entering"); InstanceGuard g(this); if (!g.Acquired()) { return Status(StatusCode::RESOURCE_EXHAUSTED, "Client worker busy"); @@ -122,6 +123,7 @@ class WorkerServiceImpl final : public WorkerService::Service { Status RunServer( ServerContext* ctx, ServerReaderWriter* stream) override { + gpr_log(GPR_INFO, "RunServer: Entering"); InstanceGuard g(this); if (!g.Acquired()) { return Status(StatusCode::RESOURCE_EXHAUSTED, "Server worker busy"); @@ -287,6 +289,15 @@ QpsWorker::QpsWorker(int driver_port, int server_port, builder->RegisterService(impl_.get()); server_ = builder->BuildAndStart(); + if (server_ == nullptr) { + gpr_log(GPR_ERROR, + "QpsWorker: Fail to BuildAndStart(driver_port=%d, server_port=%d)", + driver_port, server_port); + } else { + gpr_log(GPR_INFO, + "QpsWorker: BuildAndStart(driver_port=%d, server_port=%d) done", + driver_port, server_port); + } } QpsWorker::~QpsWorker() {}