core: SubchannelStateListener continues to receive updates after LoadBalancer is shutdown.#5883
Merged
zhangkun83 merged 4 commits intogrpc:masterfrom Jun 14, 2019
Conversation
…Balancer is shutdown. No more methods on the LoadBalancer will be called after LoadBalancer#shutdown() is called. This includes LoadBalancer#handleSubchannelState() too. SubchannelStateListener inherited this restriction. However, this special case makes onSubchannelState(SHUTDOWN) a unreliable way of being notified about Subchannel SHUTDOWN, and may confuse/complicate a wrapping LoadBalancer that expects the full notification. The javadoc isn't clear whether this restriction applies. I think it's more useful to make it no apply.
ejona86
approved these changes
Jun 14, 2019
zhangkun83
added a commit
that referenced
this pull request
Jun 14, 2019
The issue: HealthCheckingLoadBalancer.shutdown() calls hcState.onSubchannelState(SHUTDOWN) which removes that hcState from helper.hcStates. Therefore, if more than one Subchannels are present, ConcurrentModificationException will be thrown. This is an alternative approach from #5848 that was reverted in #5875. Thanks to #5883, HealthCheckingLoadBalancer.shutdown() no longer has to fake SHUTDOWN notifications, and can completely rely on Subchannels' real SHUTDOWN notifications for triggering the clean-up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No more methods on the
LoadBalancerwill be called afterLoadBalancer#shutdown()is called. This includesLoadBalancer#handleSubchannelState()too.SubchannelStateListenerinherited this restriction. However, this special case makes
onSubchannelState(SHUTDOWN)an unreliable way of being notifiedabout
SubchannelSHUTDOWN, and may confuse/complicate awrapping
LoadBalancerthat expects the full notification (e.g., #5875).The javadoc isn't clear whether this restriction applies. I think
it's more useful to make it no apply.