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(bigquery-jdbc): fix minor issues and run integration tests for otel by keshavdandeva · Pull Request #13866 · googleapis/google-cloud-java

Conversation

@keshavdandeva

@keshavdandeva keshavdandeva commented Jul 22, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

b/537284101

This PR fixes multiple OpenTelemetry resource leaks.

Key Changes

  1. Fix Thread Leaks (Reference Counting): Wrapped OpenTelemetrySdk in a CachedSdk to track usage. The SDK and its background threads are now explicitly closed when the last JDBC Connection using them is closed.
  2. Fix Classloader Leaks: Removed the redundant Runtime.addShutdownHook in BigQueryJdbcOpenTelemetry. This prevents severe Metaspace memory leaks when the driver is undeployed in Application Servers (like Tomcat/JBoss).
  3. Fix Service Account Path Fallback: Updated resolveEffectiveCredentials() to properly detect OAUTH_PVT_KEY_PATH_PROPERTY_NAME (key file paths), preventing erroneous fallbacks to Application Default Credentials.
  4. Fix Test Quota Limits: Increased the polling delay in ITOpenTelemetryTest from 500ms to 3000ms. This prevents the GCP Logging API from rejecting the test with RESOURCE_EXHAUSTED (Status 429) errors due to exceeding the 60 requests/minute quota limit.
  5. Fix ADC support

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
@keshavdandeva
test: testing presubmits
a6a224c
gemini-code-assist[bot]
gemini-code-assist Bot reviewed Jul 22, 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 integrates OpenTelemetry tracing and logging into the BigQuery JDBC driver, introducing telemetry configuration management, context propagation across asynchronous boundaries, and GCP exporters. Key feedback highlights critical issues: a potential resource and thread leak from unclosed cached OpenTelemetrySdk instances, a violation of the java.util.Properties contract by passing a non-String object that could cause ClassCastExceptions in other drivers, a missing check for the private key path property during credential resolution, and classloader leaks in application servers caused by registering a JVM shutdown hook in a static initializer.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryJdbcOpenTelemetry.java Resolved

Uh oh!

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

Comment thread java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/DataSource.java Resolved

Uh oh!

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

Comment thread java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryConnection.java Resolved

Uh oh!

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

Comment thread java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryJdbcOpenTelemetry.java Resolved

Uh oh!

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

@keshavdandeva
increase maxAttempts to wait around ~60 seconds
359ce44
@keshavdandeva
keshavdandeva changed the base branch from main to jdbc/feature-branch-otel July 22, 2026 21:52
@keshavdandeva keshavdandeva changed the title test(bigquery-jdbc): testing presubmits - do not merge test(bigquery-jdbc): fix minor issues and run integration tests for otel Jul 22, 2026
@keshavdandeva
chore: fix issues as per feedback
bcdee02
@keshavdandeva

keshavdandeva commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

/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 Jul 22, 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 reference counting for OpenTelemetry SDK instances in the BigQuery JDBC driver to ensure proper resource cleanup when connections are closed. It adds a releaseSdk method, replaces the global shutdown hook with reference-tracked caching using a new CachedSdk class, and updates BigQueryConnection to release its SDK on close. In the test suite, polling retry limits and delays are increased to improve stability. The review feedback correctly identifies a potential race condition in releaseSdk where a newly cached SDK could have its reference count incorrectly decremented and closed prematurely; a check should be added inside computeIfPresent to verify the SDK instance before decrementing.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryJdbcOpenTelemetry.java Resolved

Uh oh!

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

@keshavdandeva
address pr feedback
1a21a66
@keshavdandeva

keshavdandeva commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

/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 Jul 22, 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 reference counting for cached OpenTelemetry SDK instances in BigQueryJdbcOpenTelemetry to properly manage their lifecycle and close them when no longer needed, while also updating credential resolution logic in BigQueryConnection and adjusting integration test polling parameters. The review feedback suggests several key improvements: avoiding blocking sdk.close() calls inside ConcurrentHashMap compute lambdas to prevent locking issues, setting the connection's openTelemetry reference to null after release to prevent double-closing bugs, and initializing the SDK reference count to 1 by default to simplify instantiation.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryJdbcOpenTelemetry.java Resolved

Uh oh!

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

Comment thread java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryConnection.java Resolved

Uh oh!

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

Comment thread java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryJdbcOpenTelemetry.java Resolved

Uh oh!

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

Comment thread java-bigquery-jdbc/src/main/java/com/google/cloud/bigquery/jdbc/BigQueryJdbcOpenTelemetry.java Resolved

Uh oh!

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

@keshavdandeva
address feedback nits
11d0614
@keshavdandeva
keshavdandeva marked this pull request as ready for review July 22, 2026 22:32
@keshavdandeva
keshavdandeva requested review from a team as code owners July 22, 2026 22:32
@keshavdandeva
keshavdandeva requested a review from logachev July 22, 2026 22:32
@keshavdandeva
fix ADC support
0f42545
@keshavdandeva keshavdandeva changed the title test(bigquery-jdbc): fix minor issues and run integration tests for otel fix(bigquery-jdbc): fix minor issues and run integration tests for otel Jul 23, 2026
logachev
logachev approved these changes Jul 23, 2026
View reviewed changes
@keshavdandeva
keshavdandeva merged commit 474c626 into jdbc/feature-branch-otel Jul 23, 2026
157 of 158 checks passed

Uh oh!

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

@keshavdandeva
keshavdandeva deleted the test-otel-in-presubmit branch July 23, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

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

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