Repository navigation
gRPC client 'grpc' load balancing fails to bind with a NullPointerException when no child policies are configured - #52193
Merged
philwebb merged 2 commits intoOct 17, 2026
Conversation
Update `ServiceConfig` to protect against an NPE when no children are present. Child policies are optional and grpc-java uses round robin when none are configured, so only validate them when they are present. See spring-projectsgh-52193 Signed-off-by: Jialin Chen <cccll2019@gmail.com>
philwebb
force-pushed
the
fix/grpc-load-balancing-child
branch
from
October 17, 2026 02:03
d4378a2 to
8d74332
Compare
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.
Configuring
grpcload balancing for a gRPC client channel without anychildpolicies fails. For example:results in a
BindExceptionthat is caused by:The compact constructor of
GrpcLoadBalancingConfigvalidates the children without checking that any were bound. The rest of the record already copes withchildbeingnull, andchildPolicyis optional for grpc-java'sGrpclbLoadBalancerProvider, which uses round robin when it is absent.This change only validates the children when they are present.
Validation:
grpcLoadBalancingtest (grpc: {}) fails before the fix with the exception above and passes afterwards.:module:spring-boot-grpc-client:checkpassed (120 tests).spring.grpc.client.channel.default.service-config.loadbalancing[0].grpc.service-name=lbtoGrpcClientPropertiesfails in the same way before the fix. Afterwards, the resulting service config is{loadBalancingConfig=[{grpclb={serviceName=lb}}]}.Tested on
4.1.x(27279e255fd) with JDK 25.