Skip to content

core: Don't set firstPass=true on address update in pick_first#12679

Open
ejona86 wants to merge 2 commits intogrpc:masterfrom
ejona86:pf-fixed-firstpass
Open

core: Don't set firstPass=true on address update in pick_first#12679
ejona86 wants to merge 2 commits intogrpc:masterfrom
ejona86:pf-fixed-firstpass

Conversation

@ejona86
Copy link
Member

@ejona86 ejona86 commented Mar 6, 2026

grpc/proposal#539 updated gRFC A61 to continue
counting numTf while in first pass and to only conditionally trigger
name resolution refresh if there have been sufficient connection
failures. This prevents triggering a refresh on address updates that
don't actually change the addresses. DNS would be discarding some of
these refreshes, but if we actually implemented refreshing DNS like
other languages then it'd form a loop. (grpc-java discards refresh
requests if they are too soon after the last result; other languages
delay such requests until suffient time has passed.)

With the new gRFC language, we no longer have to have a separate
firstPass variable; the isPassComplete() function is sufficient on its
own.

Updating the addresses has no bearing if pick_first is doing the first
pass, for the sake of when refreshNameResolution() is triggered. In the
first pass pick_first is in CONNECTING and after the first pass it is in
TRANSIENT_FAILURE. If pick_first already did a first pass and is in TF,
then when it gets updated addresses it _stays_ in TF and the regular
"We will count the number of connection failures, and when that number
reaches the number of subchannels, we will request re-resolution" should
apply. Setting firstPass=true on each address update can cause us to
request refreshes too frequently.

So we only need to adjust firstPass when changing the
rawConnectivityState. And if we do that, we don't actually need
firstPass; we can use numTf instead.
@ejona86 ejona86 requested a review from kannanjgithub March 6, 2026 18:49
@ejona86
Copy link
Member Author

ejona86 commented Mar 6, 2026

I had some discussion today with @dfawley and @murgatroid99, and they both think this is working as designed. I don't believe that to be the intention, and gRFC A61 is not precise on the matter, but it'd be fair to update the gRFC if we do go this way.

I'm going to make an alternative change that only impacts serializeRetries, since that's our Java's own creation.

@ejona86 ejona86 closed this Mar 6, 2026
@ejona86 ejona86 deleted the pf-fixed-firstpass branch March 6, 2026 21:44
@ejona86 ejona86 restored the pf-fixed-firstpass branch March 6, 2026 22:23
@ejona86 ejona86 reopened this Mar 6, 2026
@ejona86
Copy link
Member Author

ejona86 commented Mar 6, 2026

Reopened because I'm going to send out a tweak to the gRFC.

(gRFC update sent out: grpc/proposal#539)

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.

1 participant