diff options
author | Ken Payson <kpayson@google.com> | 2017-11-16 12:35:43 -0800 |
---|---|---|
committer | Ken Payson <kpayson@google.com> | 2017-11-16 12:35:43 -0800 |
commit | 24908a61e413cea9cf0edf953802fc9643420777 (patch) | |
tree | a7542c40c890cccff7cb1a3ee8991a9b77fea3c1 /src | |
parent | 070f0c4b677c89052fa92bd24e9541ac1c0ef827 (diff) |
Use lock when popping requests on server shutdown
Doing this without a lock causes TSAN failures for quic.
There isn't much need to be clever here because this only impacts
shutdown performance, which doesn't really matter.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lib/surface/server.cc | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index b816439770..2e8609ee9e 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -350,14 +350,8 @@ static void request_matcher_kill_requests(grpc_exec_ctx* exec_ctx, grpc_error* error) { requested_call* rc; for (size_t i = 0; i < server->cq_count; i++) { - /* Here we know: - 1. no requests are being added (since the server is shut down) - 2. no other threads are pulling (since the shut down process is single - threaded) - So, we can ignore the queue lock and just pop, with the guarantee that a - NULL returned here truly means that the queue is empty */ - while ((rc = (requested_call*)gpr_mpscq_pop( - &rm->requests_per_cq[i].queue)) != nullptr) { + while ((rc = (requested_call*)gpr_locked_mpscq_pop( + &rm->requests_per_cq[i])) != nullptr) { fail_call(exec_ctx, server, i, rc, GRPC_ERROR_REF(error)); } } |