Skip to content

services: fix HealthCheckingLoadBalancer.shutdown()#5887

Merged
zhangkun83 merged 4 commits intogrpc:masterfrom
zhangkun83:health_check_shutdown_2
Jun 14, 2019
Merged

services: fix HealthCheckingLoadBalancer.shutdown()#5887
zhangkun83 merged 4 commits intogrpc:masterfrom
zhangkun83:health_check_shutdown_2

Conversation

@zhangkun83
Copy link
Copy Markdown
Contributor

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.

zhangkun83 and others added 4 commits June 13, 2019 15:16
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.

Since HealthCheckingLoadBalancer.shutdown() will clear the hcStates
set after the loop, it's unnecessary to do the deletion within the
loop.  However, when a Subchannel is shutdown by LoadBalancer, its
HcState still needs to be removed.  To do that, change moves the
deletion to Subchannel.shutdown().
@zhangkun83 zhangkun83 added the kokoro:force-run Add this label to a PR to tell Kokoro to re-run all tests. Not generally necessary label Jun 14, 2019
@grpc-kokoro grpc-kokoro removed the kokoro:force-run Add this label to a PR to tell Kokoro to re-run all tests. Not generally necessary label Jun 14, 2019
@zhangkun83 zhangkun83 merged commit ff33ecd into grpc:master Jun 14, 2019
@zhangkun83 zhangkun83 deleted the health_check_shutdown_2 branch June 14, 2019 23:47
@lock lock bot locked as resolved and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants