diff --git a/test/cpp/microbenchmarks/bm_fullstack.cc b/test/cpp/microbenchmarks/bm_fullstack.cc index 5795c7f4f40..153e9cf1e4c 100644 --- a/test/cpp/microbenchmarks/bm_fullstack.cc +++ b/test/cpp/microbenchmarks/bm_fullstack.cc @@ -93,6 +93,15 @@ class FullstackFixture { channel_ = CreateChannel(address, InsecureChannelCredentials()); } + virtual ~FullstackFixture() { + server_->Shutdown(); + cq_->Shutdown(); + void* tag; + bool ok; + while (cq_->Next(&tag, &ok)) { + } + } + ServerCompletionQueue* cq() { return cq_.get(); } std::shared_ptr channel() { return channel_; } @@ -169,6 +178,15 @@ class EndpointPairFixture { grpc_exec_ctx_finish(&exec_ctx); } + virtual ~EndpointPairFixture() { + server_->Shutdown(); + cq_->Shutdown(); + void* tag; + bool ok; + while (cq_->Next(&tag, &ok)) { + } + } + ServerCompletionQueue* cq() { return cq_.get(); } std::shared_ptr channel() { return channel_; } @@ -260,6 +278,8 @@ static void BM_UnaryPingPong(benchmark::State& state) { service.RequestEcho(&senv->ctx, &senv->recv_request, &senv->response_writer, fixture.cq(), fixture.cq(), tag(slot)); } + server_env[0]->~ServerEnv(); + server_env[1]->~ServerEnv(); } /*******************************************************************************