diff --git a/src/core/ext/filters/client_channel/backup_poller.cc b/src/core/ext/filters/client_channel/backup_poller.cc index 466bf86bc00..c3795c35c1f 100644 --- a/src/core/ext/filters/client_channel/backup_poller.cc +++ b/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, &g_poller->run_poller_closure); } + 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); - 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(