Merge pull request #13294 from sreecha/cc-tsan-1

Fix TSAN issue in backup poller
reviewable/pr13058/r1^2
Sree Kuchibhotla 7 years ago committed by GitHub
commit 76190cf14b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/core/ext/filters/client_channel/backup_poller.cc

@ -143,9 +143,16 @@ void grpc_client_channel_start_backup_polling(
grpc_exec_ctx_now(exec_ctx) + g_poll_interval_ms, grpc_exec_ctx_now(exec_ctx) + g_poll_interval_ms,
&g_poller->run_poller_closure); &g_poller->run_poller_closure);
} }
gpr_ref(&g_poller->refs); gpr_ref(&g_poller->refs);
/* Get a reference to g_poller->pollset before releasing g_poller_mu to make
* TSAN happy. Otherwise, reading from g_poller (i.e g_poller->pollset) after
* releasing the lock and setting g_poller to NULL in g_poller_unref() is
* being flagged as a data-race by TSAN */
grpc_pollset* pollset = g_poller->pollset;
gpr_mu_unlock(&g_poller_mu); gpr_mu_unlock(&g_poller_mu);
grpc_pollset_set_add_pollset(exec_ctx, interested_parties, g_poller->pollset);
grpc_pollset_set_add_pollset(exec_ctx, interested_parties, pollset);
} }
void grpc_client_channel_stop_backup_polling( void grpc_client_channel_stop_backup_polling(

Loading…
Cancel
Save