From 6f9985e5513c40242afb74301a96f78bc790c2a1 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Tue, 10 Oct 2017 19:00:01 -0700 Subject: Fix SIGV when grpc_channel_stack_init returns errors --- src/core/ext/filters/client_channel/backup_poller.cc | 4 ++-- src/core/ext/filters/client_channel/client_channel.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/ext/filters/client_channel/backup_poller.cc b/src/core/ext/filters/client_channel/backup_poller.cc index 3e314c74fa..3b47b6630b 100644 --- a/src/core/ext/filters/client_channel/backup_poller.cc +++ b/src/core/ext/filters/client_channel/backup_poller.cc @@ -48,8 +48,8 @@ static gpr_once g_once = GPR_ONCE_INIT; static gpr_mu g_poller_mu; static backup_poller* g_poller = NULL; // guarded by g_poller_mu // g_poll_interval_ms is set only once at the first time -// grpc_client_channel_start_backup_polling() is call, after that it is treated -// as const. +// grpc_client_channel_start_backup_polling() is called, after that it is +// treated as const. static int g_poll_interval_ms = DEFAULT_POLL_INTERVAL_MS; static void init_globals() { diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 8223f25a33..4332bfd470 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -713,6 +713,7 @@ static grpc_error *cc_init_channel_elem(grpc_exec_ctx *exec_ctx, chand->interested_parties = grpc_pollset_set_create(); grpc_connectivity_state_init(&chand->state_tracker, GRPC_CHANNEL_IDLE, "client_channel"); + grpc_client_channel_start_backup_polling(exec_ctx, chand->interested_parties); // Record client channel factory. const grpc_arg *arg = grpc_channel_args_find(args->channel_args, GRPC_ARG_CLIENT_CHANNEL_FACTORY); @@ -754,7 +755,6 @@ static grpc_error *cc_init_channel_elem(grpc_exec_ctx *exec_ctx, } chand->deadline_checking_enabled = grpc_deadline_checking_enabled(args->channel_args); - grpc_client_channel_start_backup_polling(exec_ctx, chand->interested_parties); return GRPC_ERROR_NONE; } -- cgit v1.2.3