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
b/537284101
This PR fixes multiple OpenTelemetry resource leaks.
Key Changes
- 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.
- 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).
- 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.
- 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.
- 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
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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
gemini-code-assist[bot] reacted with eyes emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.
gemini-code-assist[bot] reacted with eyes emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
logachev
logachev approved these changes
+1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
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.
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.
|