Skip to content

grpc/load_balancing: Maintain selected subchannels in pick_first. - #3027

Open
nathanielford wants to merge 2 commits into
grpc:masterfrom
nathanielford:fix/pick-first-keep-selected-subchannel
Open

nathanielford wants to merge 2 commits into
grpc:masterfrom
nathanielford:fix/pick-first-keep-selected-subchannel

Conversation

@nathanielford

@nathanielford nathanielford commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

When pick_first has a subchannel selected, a READY report from another of its subchannels will cause it to switch to that one. This is a rare race condition, but we should prevent selected subchannels from being switched out of unless they drop the connection.

Related, if a subchannel does report Ready but there is already a subchannel selected, the LB policy should remember that it is ready and select it on a new connection pass.

Solution

Add two guards:

  • Do we already have a subchannel on a READY notification? If so, don't switch. Similarly, if we get failure reports from other subchannels, record those in the state cache.
  • Do we have an already READY subchannel on a connection pass start? If so, choose it.

Notes

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants