GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(bigtable): handle empty SessionPoolConfiguration in SessionPoolImpl and PoolSizer by igorbernstein2 · Pull Request #14912 · googleapis/google-cloud-java

Conversation

@igorbernstein2

@igorbernstein2 igorbernstein2 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Summary

When session_load == 0 across all scopes, ClientConfigurationManager.normalizeConfig clears session_configuration, resulting in an empty SessionPoolConfiguration.getDefaultInstance().

This change updates PoolSizer and SessionPoolImpl to handle an empty SessionPoolConfiguration cleanly:

  • PoolSizer:
    • Guards pendingVRpcsPerSession > 0 in getScaleDelta() to prevent divide-by-zero (+Infinity -> Integer.MAX_VALUE and int overflow when inUseCount >= 1).
    • Updates handleGoAway and handleSessionClose from getScaleDelta() >= 0 to getScaleDelta() > 0 (since onSessionClosing / onSessionClosed already decrements expectedCapacity prior to consulting PoolSizer).
  • SessionPoolImpl & SessionList:
    • Guards maybeScheduleCreateSessionRetry() with budget.getMaxConcurrentRequest() <= 0 so it does not spin on a 1ms retry timer when budget == 0.
    • Makes SessionHandle.onSessionClosing() idempotent with respect to expectedCapacity.
    • In the config listener, when newConfig is SessionPoolConfiguration.getDefaultInstance(), cancels retryCreateSessionFuture and gracefully closes all sessions (CLOSE_SESSION_REASON_DOWNSIZE); when newConfig is non-empty and poolState == PoolState.STARTED, scales back up via the pre-start loop.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gemini-code-assist[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction
@igorbernstein2
fix(bigtable): handle empty SessionPoolConfiguration in SessionPoolIm…
90a7217
…pl and PoolSizer
@igorbernstein2
igorbernstein2 requested review from a team as code owners November 3, 2026 18:36
gemini-code-assist[bot]
gemini-code-assist Bot reviewed Nov 3, 2026
View reviewed changes

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

Copy link
Copy Markdown
Contributor

There was a problem hiding this 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 adds robust handling for empty or disabled session pool configurations in the Google Cloud Bigtable client. Key changes include preventing division-by-zero errors in PoolSizer when pendingVRpcsPerSession is zero, updating SessionPoolImpl to properly cancel retry futures and close active sessions when the configuration is reset to default, and adding corresponding unit tests. The review feedback correctly identifies a compilation error in SessionPoolImpl.java where Future.cancel() is called without its required boolean argument, and suggests using cancel(false) instead.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...gtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionPoolImpl.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

nimf
nimf reviewed Nov 3, 2026
View reviewed changes
Comment thread ...oud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/PoolSizer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...gtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionPoolImpl.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...oud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/PoolSizer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...gtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionPoolImpl.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@igorbernstein2
fix(bigtable): address review feedback on empty SessionPoolConfigurat…
a86f250
…ion handling
nimf
nimf approved these changes Nov 9, 2026
View reviewed changes
igorbernstein2 added 2 commits November 9, 2026 16:05
@igorbernstein2
fmt
1242426
@igorbernstein2
fix(bigtable): guard budget and pending vRPCs when SessionPoolConfigu…
8f7bbe6
…ration is disabled
mutianf
mutianf approved these changes Nov 10, 2026
View reviewed changes
Comment thread ...d-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionList.java Outdated

poolStats.startingCount--;
poolStats.readyCount++;
if (inExpectedCount) {

@mutianf mutianf Nov 10, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

do we need to set this to false after incrementing readyCount?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@igorbernstein2 igorbernstein2 Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

no, that field name is misleading. I renamed it to closing

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...d-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionList.java Outdated
inUseSessions.remove(this);

if (session.getState() == SessionState.READY) {
if (inExpectedCount && session.getState() == SessionState.READY) {

@mutianf mutianf Nov 10, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

same question here

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@igorbernstein2 igorbernstein2 Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

same :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...gtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionPoolImpl.java Outdated
@GuardedBy("poolLock")
private void maybeScheduleCreateSessionRetry() {
if (retryCreateSessionFuture != null) {
if (retryCreateSessionFuture != null || budget.getMaxConcurrentRequest() <= 0) {

@mutianf mutianf Nov 10, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

would it be better to set a sessionDisabled flag? instead of checking specific params?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@igorbernstein2 igorbernstein2 Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

good idea, centralized the logic

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@igorbernstein2
refactor(bigtable): rename inExpectedCount to closing and centralize …
eb7e4d3
…poolSizer.isDisabled()
mutianf
mutianf approved these changes Nov 10, 2026
View reviewed changes
@igorbernstein2
fix(bigtable): update removeUnstartedHandle for closing rename and ma…
53b57b3
…rk disabled volatile
mutianf
mutianf approved these changes Nov 10, 2026
View reviewed changes
@mutianf

mutianf commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

/gemini review

gemini-code-assist[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gemini-code-assist[bot]
gemini-code-assist Bot reviewed Nov 10, 2026
View reviewed changes

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

Copy link
Copy Markdown
Contributor

There was a problem hiding this 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 introduces support for dynamically disabling the session pool configuration, gracefully handling transitions to an empty or disabled state by closing active sessions, cancelling pending RPCs, and rejecting new calls. It also addresses potential race conditions during session startup and closing by replacing the inExpectedCount flag with a closing state, and fixes potential division-by-zero errors in the pool sizer. However, there are critical compilation errors in SessionPoolImpl.java where cancel() is called without the required boolean argument on Future objects (retryCreateSessionFuture and deadlineMonitor). These must be updated to cancel(false) to resolve the build failures.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...gtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionPoolImpl.java Outdated
picker.updateConfig(newConfig);
if (poolSizer.isDisabled()) {
if (retryCreateSessionFuture != null) {
retryCreateSessionFuture.cancel();

@gemini-code-assist gemini-code-assist Bot Nov 10, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

critical

Calling cancel() with no arguments on retryCreateSessionFuture (which is a ScheduledFuture or Future) will cause a compilation error in Java. The Future.cancel method requires a boolean parameter indicating whether to interrupt the running thread. Please use cancel(false) instead.

Suggested change
retryCreateSessionFuture.cancel();
retryCreateSessionFuture.cancel(false);

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...gtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionPoolImpl.java Outdated
@SuppressWarnings("GuardedBy")
private void cancel(Status status, boolean onlyCancelPendingCall) {
if (deadlineMonitor != null) {
deadlineMonitor.cancel();

@gemini-code-assist gemini-code-assist Bot Nov 10, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

critical

Calling cancel() with no arguments on deadlineMonitor (which is a ScheduledFuture or Future) will cause a compilation error in Java. The Future.cancel method requires a boolean parameter. Please use cancel(false) instead.

Suggested change
deadlineMonitor.cancel();
deadlineMonitor.cancel(false);

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...gtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionPoolImpl.java Outdated

void cancelWithResult(VRpcResult result) {
if (deadlineMonitor != null) {
deadlineMonitor.cancel();

@gemini-code-assist gemini-code-assist Bot Nov 10, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

critical

Calling cancel() with no arguments on deadlineMonitor (which is a ScheduledFuture or Future) will cause a compilation error in Java. The Future.cancel method requires a boolean parameter. Please use cancel(false) instead.

Suggested change
deadlineMonitor.cancel();
deadlineMonitor.cancel(false);

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@igorbernstein2
refactor(bigtable): rename retryCreateSessionFuture and deadlineMonit…
40aa070
…or to *Timeout
@igorbernstein2
igorbernstein2 enabled auto-merge (squash) November 10, 2026 20:40
@igorbernstein2
igorbernstein2 merged commit cc7b235 into main Nov 10, 2026
208 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@igorbernstein2
igorbernstein2 deleted the fix-session-pool-disabled-config branch November 10, 2026 21:02
@release-please release-please Bot mentioned this pull request Nov 12, 2026
chore(main): release 1.97.0 #14996
Merged
whowes pushed a commit that referenced this pull request Nov 13, 2026
@release-please
chore(main): release 1.97.0 (#14996)
fd32569
🤖 I have created a release *beep* *boop*
---


<details><summary>1.97.0</summary>

##
[1.97.0](v1.96.0...v1.97.0)
(2026-11-12)


### ⚠ BREAKING CHANGES

* **shopping-merchant:** remove discontinued Merchant API v1beta
([#14942](#14942))

### Features

* **bigquery-jdbc:** adds BigQuery graph integration to DatabaseMetadata
methods
([#14930](#14930))
([950b81b](950b81b))
* **gax:** implement resumable upload session resumption
([#14677](#14677))
([24728d6](24728d6))
* **grpc-gcp:** add built-in channel_count metric for client library
pools
([#14947](#14947))
([712f043](712f043))
* **grpc-gcp:** add built-in channel_load metric for client library
pools
([#14985](#14985))
([9f87888](9f87888))
* **shopping-merchant:** remove discontinued Merchant API v1beta
([#14942](#14942))
([2947dfd](2947dfd))
* **storage:** add StorageErrorTypeMapper for standard metrics
([#14694](#14694))
([a9ac393](a9ac393))
* **storage:** add StorageMetricsContext for operation metrics state
([#14728](#14728))
([edea395](edea395))
* **storage:** wire logical operation metrics in Retrying and
StorageOptions
([#14695](#14695))
([589c66c](589c66c))
* update API sources and regenerate
([#14958](#14958))
([75944f3](75944f3))


### Bug Fixes

* **auth:** verify public/private key match with retries in mTLS
keystore loading
([#14829](#14829))
([096dbd6](096dbd6))
* **bigquery:** set QueryResultsFormat.ARROW in QueryArrow sample
([#14960](#14960))
([c98e7c3](c98e7c3))
* **bigtable:** avoid triggering per-RPC credential session fallback on
default call context
([#14961](#14961))
([eb06d2c](eb06d2c))
* **bigtable:** copy Metadata per GetClientConfiguration call
([#14950](#14950))
([278fe2f](278fe2f))
* **bigtable:** disable SwitchingChannelPool when
ChannelPoolConfiguration is empty
([#14911](#14911))
([fa24702](fa24702))
* **bigtable:** handle empty SessionPoolConfiguration in SessionPoolImpl
and PoolSizer
([#14912](#14912))
([cc7b235](cc7b235))
* **bigtable:** replace SessionPoolImpl Watchdog with per-session
closeTimeout
([#14977](#14977))
([a15acfb](a15acfb))
* **spanner-jdbc:** report database default isolation level
([#14929](#14929))
([7e7595a](7e7595a))
* **spanner:** fix PG SHOW isolation level statements
([#14904](#14904))
([bc917ed](bc917ed))


### Dependencies

* bump grpc to 1.85.1, opentelemetry to 1.67.0, and guava to 33.7.2-jre
([#14957](#14957))
([1a27a00](1a27a00))
* bump guava to 33.7.1-jre and jspecify to 1.0.1
([#14937](#14937))
([1441527](1441527))


### Documentation

* **spanner:** update CHANGELOG.md for java spanner releases
([#14935](#14935))
([956681e](956681e))
* **storage:** add Rapid Cache samples
([#14886](#14886))
([e714f62](e714f62))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@nimf nimf nimf approved these changes
@mutianf mutianf mutianf approved these changes
+1 more reviewer
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@igorbernstein2 @mutianf @nimf
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.