core: Fix pick_first NPE when accepting resolved addresses and in CONNECTING state#12814
Open
schiemon wants to merge 1 commit into
Open
core: Fix pick_first NPE when accepting resolved addresses and in CONNECTING state#12814schiemon wants to merge 1 commit into
CONNECTING state#12814schiemon wants to merge 1 commit into
Conversation
|
|
schiemon
commented
May 19, 2026
| // addresses in the updated list. | ||
| subchannelData.updateState(newState); | ||
| if (rawConnectivityState == TRANSIENT_FAILURE || concludedState == TRANSIENT_FAILURE) { | ||
| if (newState == CONNECTING) { |
Author
There was a problem hiding this comment.
If concludedState == TRANSIENT_FAILURE but rawConnectivityState != TRANSIENT_FAILURE, shouldn't we adapt our rawConnectivityState?
schiemon
commented
May 19, 2026
|
|
||
| if (rawConnectivityState == READY | ||
| || (rawConnectivityState == CONNECTING | ||
| && (!enableHappyEyeballs || addressIndex.isValid()))) { |
Author
There was a problem hiding this comment.
Why not
Suggested change
| && addressIndex.isValid())) { |
? If we !enableHappyEyeballs and !addressIndex.isValid() then we get an exception when calling addressIndex.getCurrentAddress().
schiemon
commented
May 19, 2026
| addressIndex.updateGroups(newImmutableAddressGroups); | ||
| if (addressIndex.seekTo(previousAddress)) { | ||
| SubchannelData subchannelData = subchannels.get(previousAddress); | ||
| subchannelData.getSubchannel().updateAddresses(addressIndex.getCurrentEagAsList()); |
Author
There was a problem hiding this comment.
With HE we have potentionally multiple connecting subchannels: why aren't we updating them all?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR resolves #12796.
It makes sure that whenever
PickFirstLeafLoadBalancertransitions intoCONNECTINGthe current address in theaddressIndexhas a corresponding subchannel. This prevents an NPE when hittinggrpc-java/core/src/main/java/io/grpc/internal/PickFirstLeafLoadBalancer.java
Lines 143 to 154 in 86fa860
in
acceptResolvedAddressesin some situations.Note that for
READY, a state where this path can also be entered, this is already guaranteed.