Skip to content

Conversation

@axyjo
Copy link
Contributor

@axyjo axyjo commented Dec 9, 2025

The BigtableDataClient periodically refreshes its gRPC channel. However, when create_channel() is called during the refresh process, it doesn't include the unlimited message size options that are set during initial channel creation in init. This causes responses larger than 4 MB to fail with a ResourceExhausted error post-channel-refresh.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #1240 🦕

The BigtableDataClient periodically refreshes its gRPC channel. However,
when create_channel() is called during the refresh process, it doesn't
include the unlimited message size options that are set during initial
channel creation in __init__. This causes responses larger than 4 MB to
fail with a ResourceExhausted error post-channel-refresh.
@axyjo axyjo requested review from a team as code owners December 9, 2025 16:00
@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Dec 9, 2025
@product-auto-label product-auto-label bot added the api: bigtable Issues related to the googleapis/python-bigtable API. label Dec 9, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @axyjo, 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 resolves an issue in the BigtableDataClient where gRPC channel configuration, particularly for handling large message sizes, was not correctly reapplied during channel refresh operations. The fix ensures that the client consistently uses the necessary options to prevent ResourceExhausted errors when processing large responses, thereby improving the robustness and reliability of data retrieval from Bigtable.

Highlights

  • Bug Fix: Channel Options Lost During Refresh: Addressed a critical bug where gRPC channel options, specifically those allowing for unlimited message sizes, were not preserved when the BigtableDataClient refreshed its gRPC channel. This led to ResourceExhausted errors for responses larger than 4 MB after a channel refresh.
  • Centralized gRPC Options Definition: Introduced a global constant GRPC_CLIENT_OPTIONS to define the default gRPC options for unlimited message send and receive lengths. This centralizes the configuration and ensures consistency.
  • Consistent Channel Creation: Modified both synchronous and asynchronous create_channel methods to automatically apply GRPC_CLIENT_OPTIONS if no custom options are explicitly provided. This guarantees that refreshed or newly created channels always respect the large message size limits.
  • Refactored __init__ Methods: Updated the __init__ methods in both grpc.py and grpc_asyncio.py to remove the hardcoded options list, relying instead on the create_channel logic to apply the GRPC_CLIENT_OPTIONS.
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

@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 refactors the handling of gRPC client options for message size limits in both synchronous and asynchronous Bigtable gRPC transports. Specifically, the grpc.max_send_message_length and grpc.max_receive_message_length options, previously hardcoded to -1 within the __init__ methods of the transport classes, are now consolidated into a new global constant GRPC_CLIENT_OPTIONS. This constant is then consistently applied during channel creation via the create_channel methods in both grpc.py and grpc_asyncio.py modules, ensuring that large rows can be sent and received. There were no specific review comments provided for these changes.

@axyjo axyjo closed this Dec 9, 2025
@axyjo axyjo reopened this Dec 9, 2025
@axyjo
Copy link
Contributor Author

axyjo commented Dec 9, 2025

(will close for now -- as per the parent issue, it might've been fixed in the next minor release)

@axyjo axyjo closed this Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the googleapis/python-bigtable API. size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data Client channel refresh does not pass the same GRPC options

2 participants