Skip to content

core: Fix pick_first stalls on address update while connecting - #13210

Merged
shivaspeaks merged 2 commits into
grpc:masterfrom
shivaspeaks:happy-eyeballs-bug
Nov 30, 2026
Merged

shivaspeaks merged 2 commits into
grpc:masterfrom
shivaspeaks:happy-eyeballs-bug

Conversation

@shivaspeaks

@shivaspeaks shivaspeaks commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

#13209 stopped pick_first from starting the Connection Attempt Delay timer for the last address in the list. However, if an address update arrives while connecting and still contains the address being attempted, acceptResolvedAddresses() keeps that attempt and returns early without scheduling a timer. Before #13209, the extra timer on the last address covered this case.

As a result, when the list grew past the address being attempted (for example, [A0] -> [A0, A1]), the new addresses were not attempted until the current attempt failed. For a blackholed address, that can take the full connect timeout.

Start the timer in that path when CONNECTING, as gRFC A61 does for a subchannel that is already CONNECTING and is not the last in the list. scheduleNextConnection() already does nothing if Happy Eyeballs is disabled, there is no next address, or a timer is pending. The READY case, which also takes that path, is unchanged.

That path also skips any new addresses in front of the kept attempt. They are only tried once the walk reaches the end of the list and starts over from the beginning. processSubchannelState() does that when the current subchannel fails on the last address, but requestConnection() did not when skipping TRANSIENT_FAILURE subchannels moved it past the end.

The index was then left invalid, so later failures were ignored and isPassComplete() could never be true. With Happy Eyeballs enabled, the LB stayed in CONNECTING without trying the skipped addresses or requesting re-resolution. For example, with subchannels {C: TRANSIENT_FAILURE, B: CONNECTING} and an update to [D, B, C], moving from B to C (by the timer above, or by B failing) went past the end and D was never attempted. This predates #13209.

Start over from the beginning in requestConnection() too, when some addresses don't have a subchannel yet.

cl/1031755943

@shivaspeaks
shivaspeaks marked this pull request as ready for review November 30, 2026 05:13
@shivaspeaks

Copy link
Copy Markdown
Member Author

CC: @kannanjgithub

@shivaspeaks shivaspeaks changed the title core: Start Happy Eyeballs timer on address update while connecting core: Fix pick_first stalls on address update while connecting Nov 30, 2026
@shivaspeaks
shivaspeaks merged commit b59fb88 into grpc:master Nov 30, 2026
18 checks passed
@shivaspeaks
shivaspeaks deleted the happy-eyeballs-bug branch November 30, 2026 16:02
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.

3 participants