Skip to content

fix(gax-grpc): add pick_first fallback to direct path service config#4143

Merged
blakeli0 merged 3 commits intogoogleapis:mainfrom
westarle:fix/grpclb-fallback
Mar 16, 2026
Merged

fix(gax-grpc): add pick_first fallback to direct path service config#4143
blakeli0 merged 3 commits intogoogleapis:mainfrom
westarle:fix/grpclb-fallback

Conversation

@westarle
Copy link
Contributor

The Dependency Compatibility Test CI workflow has been failing on the InstantiatingGrpcChannelProviderTest tests (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-java v1.77.0, the grpc-grpclb artifact is no longer implicitly included because the legacy grpclb load balancer plugin is deprecated (Tracked in #4012). However, InstantiatingGrpcChannelProvider still hardcoded grpclb as its primary DirectPath load balancing policy.

This missing plugin crashes tests, but the backend Google grpclb lookaside servers were also officially turned down in July 2025. Because the library still explicitly requests grpclb, 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 grpclb and replaces it with pick_first in getDefaultDirectPathServiceConfig().

We deliberately choose pick_first to 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 the xds API, configuring it as a default fallback would require complex bootstrap configurations and cause crashes for clients
without that setup. pick_first stops the DNS spam entirely, ensures stability on modern gRPC versions, and resolves the test failures.

@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Mar 14, 2026
@westarle westarle marked this pull request as draft March 14, 2026 04:45
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 gax-grpc library by replacing the deprecated grpclb load balancing policy with pick_first for DirectPath service configurations. This change directly resolves recurring Dependency Compatibility Test failures stemming from the grpc-grpclb artifact's removal in recent grpc-java versions. Furthermore, it eliminates a significant source of network noise by preventing gRPC from repeatedly querying for non-existent grpclb servers, thereby improving system stability and reducing DNS error logs. The adoption of pick_first ensures continued adherence to the original design principle of maintaining a single connection per GAX channel.

Highlights

  • Resolved Test Failures: Fixed Dependency Compatibility Test failures in InstantiatingGrpcChannelProviderTest caused by the removal of the grpc-grpclb artifact in grpc-java v1.77.0.
  • Eliminated DNS Spam: Addressed a critical issue causing gRPC to continuously spam DNS with _grpclb._tcp.* SRV queries, resulting in approximately 22,000 NXDOMAIN errors daily, by removing the explicit request for the deprecated grpclb policy.
  • Updated Load Balancing Policy: Replaced the deprecated grpclb load balancing policy with pick_first in getDefaultDirectPathServiceConfig() to ensure stability and maintain the original design intent of one connection per pooled GAX channel.
Changelog
  • gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java
    • Removed the grpclb load balancing policy from the default DirectPath service configuration.
    • Updated internal comments to reflect the change to the pick_first strategy.
  • gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java
    • Updated test configurations to use pick_first instead of grpclb for DirectPath service configurations.
    • Modified assertions to validate the presence of pick_first as the load balancing policy.
Activity
  • westarle opened this pull request to address critical issues with grpclb deprecation.
  • The Dependency Compatibility Test CI workflow was failing, indicating automated testing activity.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@blakeli0 blakeli0 marked this pull request as ready for review March 16, 2026 20:34
@blakeli0 blakeli0 merged commit b150fe9 into googleapis:main Mar 16, 2026
50 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants