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): allow non-default service accounts for session DirectAccess by sushanb · Pull Request #14926 · googleapis/google-cloud-java

Conversation

@sushanb

@sushanb sushanb commented Nov 4, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Problem

Workloads running on Compute Engine or GKE with a non-default service account (for example, GKE Workload Identity Federation or explicit service account credentials) cannot establish DirectPath (DirectAccess) connections on the session-based protocol path (ShimImpl and GaxDirectAccessChannelProvider), even when classic unary RPCs on the same client successfully use DirectPath. Instead, session channels fall back to CloudPath (GaxBasicChannelProvider) and report direct_access/compatible=0.

Root Cause

ShimImpl.create and both factory methods in GaxDirectAccessChannelProvider (create and createWithFallback) called .setAttemptDirectPath(true).setAttemptDirectPathXds() without setting .setAllowNonDefaultServiceAccount(true).

Without setAllowNonDefaultServiceAccount(true), InstantiatingGrpcChannelProvider.isCredentialDirectPathCompatible() only accepts ComputeEngineCredentials and returns false for other credential types. Consequently, directAccessProvider.canUseDirectPath() returns false in GaxDirectAccessChannelProvider, causing GaxDirectAccessChannelProvider.createWithFallback to immediately return a CloudPath GaxBasicChannelProvider.

Fix

  • Enable .setAllowNonDefaultServiceAccount(true) on the DirectAccess InstantiatingGrpcChannelProvider builders in ShimImpl.create, GaxDirectAccessChannelProvider.create, and GaxDirectAccessChannelProvider.createWithFallback.

Testing

  • Added GaxDirectAccessChannelProviderTest verifying that create and createWithFallback return GaxDirectAccessChannelProvider on a GCE Linux environment when configured with non-ComputeEngineCredentials credentials.

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
@sushanb
sushanb requested review from a team as code owners November 4, 2026 22:04
gemini-code-assist[bot]
gemini-code-assist Bot reviewed Nov 4, 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 refactors the creation of direct access channel and transport providers in GaxDirectAccessChannelProvider and ShimImpl to use EnhancedBigtableStubSettings.applyDirectAccessTraitsInternal, and introduces corresponding unit tests. The feedback highlights that the new tests rely on reflection to modify static final fields and access private fields of GAX's InstantiatingGrpcChannelProvider. This approach is highly fragile and will fail on modern JDKs (Java 12+ and 17+) due to strong encapsulation, so alternative testing strategies should be used.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread ...va/com/google/cloud/bigtable/data/v2/internal/compat/GaxDirectAccessChannelProviderTest.java
Comment on lines +70 to +71
setStaticField(
InstantiatingGrpcChannelProvider.class, "systemProductName", "Google Compute Engine");

@gemini-code-assist gemini-code-assist Bot Nov 4, 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.

high

Modifying static final fields (like systemProductName in InstantiatingGrpcChannelProvider) via reflection is highly fragile and will fail on modern JDKs (Java 12+ / Java 17+). In Java 12+, the JDK blocks modifying static final fields via reflection, throwing an IllegalAccessException. Additionally, strong encapsulation in Java 17+ will throw InaccessibleObjectException when attempting to access private fields of classes in other modules/packages without explicit --add-opens JVM arguments. Consider avoiding tests that rely on modifying GAX's internal static final fields. Since buildDirectAccessProvider is already unit-tested, we can rely on those assertions rather than trying to simulate a GCE environment by hacking GAX internals.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread ...d-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/compat/ShimImplTest.java Outdated
Comment on lines +76 to +80
private static Object getField(Object instance, String fieldName) throws Exception {
Field field = instance.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
return field.get(instance);
}

@gemini-code-assist gemini-code-assist Bot Nov 4, 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.

medium

Using reflection to access private fields of InstantiatingGrpcChannelProvider (which resides in the GAX library) will fail with InaccessibleObjectException on Java 17+ due to strong encapsulation, unless explicit --add-opens JVM arguments are provided to the test runner. Since these are internal implementation details of GAX, relying on them makes the tests fragile to GAX updates. If public getters are not available, consider if these assertions are strictly necessary or if they can be verified through other public behaviors/side-effects.

Sorry, something went wrong.

Uh oh!

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

All reactions
@sushanb
sushanb force-pushed the fix/bigtable-directaccess-traits branch from 35496b3 to 44af920 Compare November 4, 2026 22:08
@sushanb sushanb changed the title fix(bigtable): apply DirectAccess traits in ShimImpl and GaxDirectAccessChannelProvider fix(bigtable): allow non-default service accounts for session DirectAccess Nov 4, 2026
mutianf
mutianf approved these changes Nov 4, 2026
View reviewed changes
@sushanb
fix(bigtable): allow non-default service accounts for session DirectA…
026bfed
…ccess
@sushanb
sushanb force-pushed the fix/bigtable-directaccess-traits branch from 44af920 to 026bfed Compare November 5, 2026 03:39
@sushanb
sushanb enabled auto-merge (squash) November 5, 2026 03:52
@sushanb
sushanb merged commit 9f4a76a into googleapis:main Nov 5, 2026
208 checks passed

Uh oh!

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

@release-please release-please Bot mentioned this pull request Nov 5, 2026
chore(main): release 1.96.0 #14934
Merged
jinseopkim0 pushed a commit that referenced this pull request Nov 5, 2026
@release-please
chore(main): release 1.96.0 (#14934)
524d6c9
🤖 I have created a release *beep* *boop*
---


<details><summary>1.96.0</summary>

##
[1.96.0](v1.95.0...v1.96.0)
(2026-11-05)


### Features

* **gax:** wire-level changes for resuming uploads
([#14870](#14870))
([956ac4d](956ac4d))


### Bug Fixes

* **bigquery-jdbc:** preserve civil digits for DATETIME/DATE
([#14910](#14910))
([53bbde0](53bbde0))
* **bigquery:** handle empty queryParameters list in ConnectionImpl
([#14917](#14917))
([cfea223](cfea223))
* **bigtable:** allow non-default service accounts for session
DirectAccess
([#14926](#14926))
([9f4a76a](9f4a76a))
</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

@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.

2 participants

@sushanb @mutianf
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.