fix(gax-grpc): add pick_first fallback to direct path service config#4143
fix(gax-grpc): add pick_first fallback to direct path service config#4143blakeli0 merged 3 commits intogoogleapis:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request provides a crucial update to the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly addresses the deprecation of the grpclb load balancing policy by replacing it with pick_first as the default for DirectPath. This change resolves CI failures and mitigates a DNS spam issue caused by requests for the now-defunct grpclb servers. The implementation is clean and the corresponding test updates are appropriate. I have one minor suggestion to improve consistency in the test code.
The
Dependency Compatibility TestCI workflow has been failing on theInstantiatingGrpcChannelProviderTesttests (e.g.canUseDirectPath_happyPath) with the following error during initialization:java.lang.IllegalStateException: Default config is invalid: Status{code=UNKNOWN, description=None of [grpclb] specified by Service Config are available., cause=null}Root Cause & DNS Spam Issue:
As of
grpc-javav1.77.0, thegrpc-grpclbartifact is no longer implicitly included because the legacygrpclbload balancer plugin is deprecated (Tracked in #4012). However,InstantiatingGrpcChannelProviderstill hardcodedgrpclbas its primary DirectPath load balancing policy.This missing plugin crashes tests, but the backend Google
grpclblookaside servers were also officially turned down in July 2025. Because the library still explicitly requestsgrpclb, it causes gRPC to continuously spam DNS with_grpclb._tcp.*SRV queries trying to find those dead servers. This leads to ~22,000 NXDOMAIN DNS errors a day on user networks (Tracked in googleapis/java-pubsub#2404).Fix:
This PR completely removes
grpclband replaces it withpick_firstingetDefaultDirectPathServiceConfig().We deliberately choose
pick_firstto preserve the original 2019 design intent (maintaining exactly one connection per pooled GAX channel to emulate CFE behavior) and to provide a safe, fail-open default. While Traffic Director relies on thexdsAPI, configuring it as a default fallback would require complex bootstrap configurations and cause crashes for clientswithout that setup.
pick_firststops the DNS spam entirely, ensures stability on modern gRPC versions, and resolves the test failures.