diff options
author | Vijay Pai <vpai@google.com> | 2016-01-27 13:39:35 -0800 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2016-01-27 13:39:35 -0800 |
commit | 1613fdfb785e9cac08c5c9063315629a8c275962 (patch) | |
tree | 48cfd3abbd046ead8af3fd38b9b19736b5976d38 /src | |
parent | 1b3b1ee05aba5eedf4ffe5b341aa3a0257e5bbf7 (diff) | |
parent | 049c8cc4ffb2148d7c8340970f87cf3718cfa8f6 (diff) |
Merge pull request #4888 from ctiller/twah
Fix some outstanding TSAN issues
Diffstat (limited to 'src')
-rw-r--r-- | src/core/client_config/lb_policies/pick_first.c | 4 | ||||
-rw-r--r-- | src/core/client_config/subchannel.c | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/core/client_config/lb_policies/pick_first.c b/src/core/client_config/lb_policies/pick_first.c index e6ddb1a11f..5b10600ab5 100644 --- a/src/core/client_config/lb_policies/pick_first.c +++ b/src/core/client_config/lb_policies/pick_first.c @@ -76,7 +76,7 @@ typedef struct { } pick_first_lb_policy; #define GET_SELECTED(p) \ - ((grpc_connected_subchannel *)gpr_atm_no_barrier_load(&(p)->selected)) + ((grpc_connected_subchannel *)gpr_atm_acq_load(&(p)->selected)) void pf_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { pick_first_lb_policy *p = (pick_first_lb_policy *)pol; @@ -268,10 +268,10 @@ static void pf_connectivity_changed(grpc_exec_ctx *exec_ctx, void *arg, selected = grpc_subchannel_get_connected_subchannel(selected_subchannel); GPR_ASSERT(selected != NULL); - gpr_atm_no_barrier_store(&p->selected, (gpr_atm)selected); GRPC_CONNECTED_SUBCHANNEL_REF(selected, "picked_first"); /* drop the pick list: we are connected now */ GRPC_LB_POLICY_WEAK_REF(&p->base, "destroy_subchannels"); + gpr_atm_rel_store(&p->selected, (gpr_atm)selected); grpc_exec_ctx_enqueue(exec_ctx, grpc_closure_create(destroy_subchannels, p), 1); /* update any calls that were waiting for a pick */ diff --git a/src/core/client_config/subchannel.c b/src/core/client_config/subchannel.c index 2992da8b79..748eef9bed 100644 --- a/src/core/client_config/subchannel.c +++ b/src/core/client_config/subchannel.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -519,7 +519,12 @@ static void publish_transport(grpc_exec_ctx *exec_ctx, grpc_subchannel *c) { } /* publish */ - GPR_ASSERT(gpr_atm_no_barrier_cas(&c->connected_subchannel, 0, (gpr_atm)con)); + /* TODO(ctiller): this full barrier seems to clear up a TSAN failure. + I'd have expected the rel_cas below to be enough, but + seemingly it's not. + Re-evaluate if we really need this. */ + gpr_atm_full_barrier(); + GPR_ASSERT(gpr_atm_rel_cas(&c->connected_subchannel, 0, (gpr_atm)con)); c->connecting = 0; /* setup subchannel watching connected subchannel for changes; subchannel ref |