Merge pull request #19692 from grpc/vjpai-patch-1

Resolve a race when background poller outlives executor
pull/19708/head
Vijay Pai 6 years ago committed by GitHub
commit 1253beb3e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/core/lib/iomgr/combiner.cc

@ -233,11 +233,11 @@ bool grpc_combiner_continue_exec_ctx() {
// offload only if all the following conditions are true: // offload only if all the following conditions are true:
// 1. the combiner is contended and has more than one closure to execute // 1. the combiner is contended and has more than one closure to execute
// 2. the current execution context needs to finish as soon as possible // 2. the current execution context needs to finish as soon as possible
// 3. the DEFAULT executor is threaded // 3. the current thread is not a worker for any background poller
// 4. the current thread is not a worker for any background poller // 4. the DEFAULT executor is threaded
if (contended && grpc_core::ExecCtx::Get()->IsReadyToFinish() && if (contended && grpc_core::ExecCtx::Get()->IsReadyToFinish() &&
grpc_core::Executor::IsThreadedDefault() && !grpc_iomgr_is_any_background_poller_thread() &&
!grpc_iomgr_is_any_background_poller_thread()) { grpc_core::Executor::IsThreadedDefault()) {
GPR_TIMER_MARK("offload_from_finished_exec_ctx", 0); GPR_TIMER_MARK("offload_from_finished_exec_ctx", 0);
// this execution context wants to move on: schedule remaining work to be // this execution context wants to move on: schedule remaining work to be
// picked up on the executor // picked up on the executor

Loading…
Cancel
Save