diff options
author | Sree Kuchibhotla <sreecha@users.noreply.github.com> | 2017-11-09 14:58:50 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-09 14:58:50 -0800 |
commit | 76190cf14babab747d77f4fe0fca1af2ba7e7b8b (patch) | |
tree | 4a2c5422bdb342124bc6e2bbd191405437fafe89 /src/core | |
parent | ce1c7db84cb75055caef33f8bf80b40b6965ebce (diff) | |
parent | 3a128c098fff4e2fd93f006d7c128735cec62611 (diff) |
Merge pull request #13294 from sreecha/cc-tsan-1
Fix TSAN issue in backup poller
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ext/filters/client_channel/backup_poller.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/ext/filters/client_channel/backup_poller.cc b/src/core/ext/filters/client_channel/backup_poller.cc index 466bf86bc0..c3795c35c1 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( |