aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-07-20 22:00:24 -0700
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-07-20 22:00:24 -0700
commit3d57871e9dd90d7302655cb4a6563fd1adca917b (patch)
treea42f0b76675c2d1eb8fb7b9b16019f26e4c1ba9a
parent40d808ffdc00831fdb31f7ed11610a21854a18ee (diff)
Fix TSAN reported failure
-rw-r--r--src/core/channel/client_channel.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c
index 10e01ebbb4..09d71eb736 100644
--- a/src/core/channel/client_channel.c
+++ b/src/core/channel/client_channel.c
@@ -236,18 +236,15 @@ static void picked_target(void *arg, int iomgr_success) {
}
}
-static void pick_target(grpc_lb_policy *lb_policy, call_data *calld) {
+static void pick_target(
+ grpc_lb_policy *lb_policy, call_data *calld, grpc_pollset *bind_pollset) {
grpc_metadata_batch *initial_metadata;
grpc_transport_stream_op *op = &calld->waiting_op;
- GPR_ASSERT(op->bind_pollset);
- GPR_ASSERT(op->send_ops);
- GPR_ASSERT(op->send_ops->nops >= 1);
- GPR_ASSERT(op->send_ops->ops[0].type == GRPC_OP_METADATA);
initial_metadata = &op->send_ops->ops[0].data.metadata;
grpc_iomgr_closure_init(&calld->async_setup_task, picked_target, calld);
- grpc_lb_policy_pick(lb_policy, op->bind_pollset, initial_metadata,
+ grpc_lb_policy_pick(lb_policy, bind_pollset, initial_metadata,
&calld->picked_channel, &calld->async_setup_task);
}
@@ -358,12 +355,19 @@ static void perform_transport_stream_op(grpc_call_element *elem,
gpr_mu_lock(&chand->mu_config);
lb_policy = chand->lb_policy;
if (lb_policy) {
+ grpc_pollset *bind_pollset = calld->waiting_op.bind_pollset;
GRPC_LB_POLICY_REF(lb_policy, "pick");
gpr_mu_unlock(&chand->mu_config);
calld->state = CALL_WAITING_FOR_PICK;
+
+ GPR_ASSERT(calld->waiting_op.bind_pollset);
+ GPR_ASSERT(calld->waiting_op.send_ops);
+ GPR_ASSERT(calld->waiting_op.send_ops->nops >= 1);
+ GPR_ASSERT(
+ calld->waiting_op.send_ops->ops[0].type == GRPC_OP_METADATA);
gpr_mu_unlock(&calld->mu_state);
- pick_target(lb_policy, calld);
+ pick_target(lb_policy, calld, bind_pollset);
GRPC_LB_POLICY_UNREF(lb_policy, "pick");
} else if (chand->resolver != NULL) {