Merge pull request #23171 from grpc/fix-resource-quota

Do not unref resource user when no allocations are aborted
reviewable/pr22951/r5
Muxi Yan 5 years ago committed by GitHub
commit 9156cadd43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/core/lib/iomgr/resource_quota.cc

@ -320,9 +320,9 @@ static bool rq_alloc(grpc_resource_quota* resource_quota) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
gpr_log(GPR_INFO,
"RQ: check allocation for user %p shutdown=%" PRIdPTR
" free_pool=%" PRId64,
" free_pool=%" PRId64 " outstanding_allocations=%" PRId64,
resource_user, gpr_atm_no_barrier_load(&resource_user->shutdown),
resource_user->free_pool);
resource_user->free_pool, resource_user->outstanding_allocations);
}
if (gpr_atm_no_barrier_load(&resource_user->shutdown)) {
resource_user->allocating = false;
@ -334,7 +334,9 @@ static bool rq_alloc(grpc_resource_quota* resource_quota) {
resource_user->free_pool += aborted_allocations;
grpc_core::ExecCtx::RunList(DEBUG_LOCATION, &resource_user->on_allocated);
gpr_mu_unlock(&resource_user->mu);
ru_unref_by(resource_user, static_cast<gpr_atm>(aborted_allocations));
if (aborted_allocations > 0) {
ru_unref_by(resource_user, static_cast<gpr_atm>(aborted_allocations));
}
continue;
}
if (resource_user->free_pool < 0 &&

Loading…
Cancel
Save