diff options
author | kpayson64 <kpayson@google.com> | 2017-11-16 18:35:01 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-16 18:35:01 -0800 |
commit | c35a660300610c14910dfc6d006b86eff0d2039d (patch) | |
tree | 1877adb36a229153cd290c1e52af31abb2c8b952 /src | |
parent | 6d6636987bb36e35fe0197a1ed578d22f3ffde59 (diff) | |
parent | 24908a61e413cea9cf0edf953802fc9643420777 (diff) |
Merge pull request #13422 from kpayson64/quic_tsan_fix
Use lock when popping requests on server shutdown
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)); } } |