From 34aa71464482b4b93b81ff430e942b9aa2517b49 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Fri, 8 Mar 2019 15:37:09 -0800 Subject: [PATCH] Remove pollset_set when resetting LB policies --- .../filters/client_channel/lb_policy/grpclb/grpclb.cc | 11 +++++++++++ .../ext/filters/client_channel/lb_policy/xds/xds.cc | 11 +++++++++++ .../ext/filters/client_channel/resolving_lb_policy.cc | 3 +++ 3 files changed, 25 insertions(+) diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index 184215a3da9..34fe88215fe 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -625,6 +625,9 @@ void GrpcLb::Helper::UpdateState(grpc_connectivity_state state, GRPC_ERROR_UNREF(state_error); return; } + grpc_pollset_set_del_pollset_set( + parent_->child_policy_->interested_parties(), + parent_->interested_parties()); MutexLock lock(&parent_->child_policy_mu_); parent_->child_policy_ = std::move(parent_->pending_child_policy_); } else if (!CalledByCurrentChild()) { @@ -1272,6 +1275,14 @@ void GrpcLb::ShutdownLocked() { if (fallback_timer_callback_pending_) { grpc_timer_cancel(&lb_fallback_timer_); } + if (child_policy_ != nullptr) { + grpc_pollset_set_del_pollset_set(child_policy_->interested_parties(), + interested_parties()); + } + if (pending_child_policy_ != nullptr) { + grpc_pollset_set_del_pollset_set( + pending_child_policy_->interested_parties(), interested_parties()); + } { MutexLock lock(&child_policy_mu_); child_policy_.reset(); diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index 4b386d37797..eca41bf3a2e 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -430,6 +430,9 @@ void XdsLb::Helper::UpdateState(grpc_connectivity_state state, GRPC_ERROR_UNREF(state_error); return; } + grpc_pollset_set_del_pollset_set( + parent_->child_policy_->interested_parties(), + parent_->interested_parties()); MutexLock lock(&parent_->child_policy_mu_); parent_->child_policy_ = std::move(parent_->pending_child_policy_); } else if (!CalledByCurrentChild()) { @@ -1154,6 +1157,14 @@ void XdsLb::ShutdownLocked() { if (fallback_timer_callback_pending_) { grpc_timer_cancel(&lb_fallback_timer_); } + if (child_policy_ != nullptr) { + grpc_pollset_set_del_pollset_set(child_policy_->interested_parties(), + interested_parties()); + } + if (pending_child_policy_ != nullptr) { + grpc_pollset_set_del_pollset_set( + pending_child_policy_->interested_parties(), interested_parties()); + } { MutexLock lock(&child_policy_mu_); child_policy_.reset(); diff --git a/src/core/ext/filters/client_channel/resolving_lb_policy.cc b/src/core/ext/filters/client_channel/resolving_lb_policy.cc index 0dd51e8bc4c..52b14dcc7de 100644 --- a/src/core/ext/filters/client_channel/resolving_lb_policy.cc +++ b/src/core/ext/filters/client_channel/resolving_lb_policy.cc @@ -110,6 +110,9 @@ class ResolvingLoadBalancingPolicy::ResolvingControlHelper GRPC_ERROR_UNREF(state_error); return; } + grpc_pollset_set_del_pollset_set( + parent_->lb_policy_->interested_parties(), + parent_->interested_parties()); MutexLock lock(&parent_->lb_policy_mu_); parent_->lb_policy_ = std::move(parent_->pending_lb_policy_); } else if (!CalledByCurrentChild()) {