Skip to content

fix(pick_first): ignore state updates from shut down or replaced subchannels - #12968

Draft
AgraVator wants to merge 1 commit into
grpc:masterfrom
AgraVator:fix-pickfirst-stale-subchannel
Draft

fix(pick_first): ignore state updates from shut down or replaced subchannels#12968
AgraVator wants to merge 1 commit into
grpc:masterfrom
AgraVator:fix-pickfirst-stale-subchannel

Conversation

@AgraVator

Copy link
Copy Markdown
Contributor

In legacy PickFirstLoadBalancer, when handleNameResolutionError() or shutdown() is called, subchannel.shutdown() is invoked. Because ManagedChannelImpl delays subchannel shutdown by 5 seconds (SUBCHANNEL_SHUTDOWN_DELAY_SECONDS), the old subchannel may complete a connection attempt during this window and fire READY state updates. Without a check verifying if the calling subchannel is still the current active subchannel, PickFirstLoadBalancer publishes a READY picker for the obsolete subchannel right before its 5-second delayed shutdown task fires and kills the transport. This leaves the channel permanently stuck in READY with a dead subchannel picker.

Fixes #12958

…hannels

In legacy PickFirstLoadBalancer, when handleNameResolutionError() or shutdown() is called, subchannel.shutdown() is invoked.
Because ManagedChannelImpl delays subchannel shutdown by 5 seconds (SUBCHANNEL_SHUTDOWN_DELAY_SECONDS), the old subchannel may complete a connection attempt during this window and fire READY state updates.
Without a check verifying if the calling subchannel is still the current active subchannel, PickFirstLoadBalancer publishes a READY picker for the obsolete subchannel right before its 5-second delayed shutdown task fires and kills the transport. This leaves the channel permanently stuck in READY with a dead subchannel picker.

Fixes grpc#12958
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant