aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/filters/client_channel
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2017-10-10 15:02:43 -0700
committerGravatar Mark D. Roth <roth@google.com>2017-10-10 15:02:43 -0700
commit0c11ebaa6c7e2cf0c1f49fc0f094ca9fe98c67e4 (patch)
tree2274afde97f563524210b17e630b5dfc9c1fec8d /src/core/ext/filters/client_channel
parent7ba40baeb1821fd312cb7d03c8e9e2383869120b (diff)
Fix crash when not able to create subchannel.
Diffstat (limited to 'src/core/ext/filters/client_channel')
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
index c30416d124..df23a32f97 100644
--- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
@@ -129,6 +129,20 @@ grpc_lb_subchannel_list *grpc_lb_subchannel_list_create(
grpc_subchannel *subchannel = grpc_client_channel_factory_create_subchannel(
exec_ctx, args->client_channel_factory, &sc_args);
grpc_channel_args_destroy(exec_ctx, new_args);
+ if (subchannel == NULL) {
+ // Subchannel could not be created.
+ if (GRPC_TRACER_ON(grpc_lb_round_robin_trace) ||
+ GRPC_TRACER_ON(grpc_lb_pick_first_trace)) {
+ char *address_uri =
+ grpc_sockaddr_to_uri(&addresses->addresses[i].address);
+ gpr_log(GPR_DEBUG,
+ "[LB %p] could not create subchannel for address uri %s, "
+ "ignoring",
+ subchannel_list->policy, address_uri);
+ gpr_free(address_uri);
+ }
+ continue;
+ }
grpc_error *error;
// Get the connectivity state of the subchannel. Already existing ones may
// be in a state other than INIT.