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): abort session when connection is closed by Neenu1995 · Pull Request #14273 · googleapis/google-cloud-java

Conversation

@Neenu1995

@Neenu1995 Neenu1995 commented Sep 4, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Fixes #13922

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
@Neenu1995
fix(bigquery-jdbc): abort session when connection is closed
f42828d
@Neenu1995
Neenu1995 requested review from a team as code owners September 4, 2026 18:56
gemini-code-assist[bot]
gemini-code-assist Bot reviewed Sep 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 introduces changes to automatically abort active BigQuery sessions when a connection is closed. Specifically, it adds an abortSession method in BigQueryConnection that executes CALL BQ.ABORT_SESSION(); and cleans up session-related connection properties. Corresponding unit and integration tests have been added to verify this behavior. The feedback suggests a minor improvement to the exception message when handling InterruptedException to more accurately reflect that the interruption occurred during session abortion.

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/BigQueryConnection.java Resolved

Uh oh!

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

@Neenu1995 Neenu1995 mentioned this pull request Sep 4, 2026
bigquery-jdbc: unable to run SQL 'CALL BQ.ABORT_SESSION()' #13922
Closed
Neenu1995 added 5 commits September 4, 2026 15:08
@Neenu1995
nit
488ea70
@Neenu1995
fix test
4840c9e
@Neenu1995
nit
f12d6f4
@Neenu1995
Merge branch 'main' into fix-session-abort
957b760
@Neenu1995
ony abort driver created session
ad5f561
logachev
logachev reviewed Sep 9, 2026
View reviewed changes
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/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/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/BigQueryConnection.java Resolved

Uh oh!

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

keshavdandeva
keshavdandeva reviewed Sep 9, 2026
View reviewed changes
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.

Neenu1995 and others added 5 commits September 17, 2026 11:38
@Neenu1995
merge conflicts with main
ed91a11
@Neenu1995
publish session state as a n atomic snapshot
5182a53
@Neenu1995
make the session write onec per connection
a72f736
@Neenu1995
Merge branch 'main' into fix-session-abort
5bf8eec
@Neenu1995
fix tests
b74de6d
@Neenu1995
Neenu1995 requested review from keshavdandeva and logachev September 18, 2026 00:51
keshavdandeva
keshavdandeva reviewed Sep 18, 2026
View reviewed changes
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.

@Neenu1995
fix exception
69310bf
@Neenu1995
Neenu1995 requested a review from keshavdandeva September 18, 2026 13:28
@Neenu1995
fix exceptions
1769456
logachev
logachev reviewed Sep 21, 2026
View reviewed changes
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/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/BigQueryConnection.java
}

SessionState snapshot = this.sessionState.get();
if (snapshot.sessionInfo != null && snapshot.createdByDriver) {

@logachev logachev Sep 21, 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.

In what case sessionInfo is allowed to be null? It is initizlied with non-null value and never reset

Sorry, something went wrong.

Uh oh!

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

All reactions

@Neenu1995 Neenu1995 Sep 22, 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.

SessionState is first initialized with null value for SessionInfo. SessionState is never null but SessionInfo can be null.

Sorry, something went wrong.

Uh oh!

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

All reactions

@logachev logachev Sep 25, 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.

https://github.com/googleapis/google-cloud-java/pull/14273/changes/BASE..17694562cb51b432bf9a0febef2b951e96457b74#diff-ee5681a041321f7226e326bdf5a7f088d93f53e67d1d973a7ae93493a9f1a2a6R378 -> it is initialized in constructor with non-null

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/BigQueryConnection.java
List<ConnectionProperty> connectionProperties = new ArrayList<ConnectionProperty>();
if (queryPropertiesMap != null) {
for (Map.Entry<String, String> entry : queryPropertiesMap.entrySet()) {
String key = isSessionIdKey(entry.getKey()) ? SESSION_ID_KEY : entry.getKey();

@logachev logachev Sep 21, 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.

Why having special-case for session_id?

Sorry, something went wrong.

Uh oh!

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

All reactions

@Neenu1995 Neenu1995 Sep 22, 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.

Since we need to access Session ID multiple times later, this is essentially normalizing the sessionID key and making it caseInSensitive, instead of checking for case everywhere it is accessed.

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/BigQueryConnection.java
this.bigQuery.query(abortSessionJobConfig);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new BigQueryJdbcRuntimeException("Interrupted during session abort", ex);

@logachev logachev Sep 21, 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.

I'd just remove this. Why do we need to wrap it with our exception?

Sorry, something went wrong.

Uh oh!

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

All reactions

@Neenu1995 Neenu1995 Sep 22, 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.

By convention we almost always throw InterruptedException wrapped in our custom exception. But looking at the code base, I can see it is not always consistent. There are a few places in the DBMetadata class it gets thrown directly or converts to SQLException.
Maybe we need to look at out Exception strategy to make sure everything is consistent.

Sorry, something went wrong.

Uh oh!

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

All reactions

@logachev logachev Sep 23, 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.

I think we need to revisis this. InterruptedException and RuntimeException are different, so if we re-throw InterruptedExceptin as RuntimeException, callers might handle it differently (or not handle at all since RuntimeException is unchecked in Java)

Sorry, something went wrong.

Uh oh!

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

All reactions

@Neenu1995 Neenu1995 Sep 24, 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.

Sure. I will revise this in a follow up PR to ensure consistency across code base.

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/BigQueryConnection.java Outdated

/**
* Returns a copy of this state with {@code session_id} set to {@code sessionId}, collapsing any
* pre-existing entries that differ only by case.

@logachev logachev Sep 21, 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.

I don't think we should collapse entries entries that different by case. How are we going to determine priority?

If we have multiple entries differing by case we should just throw an exception rather than trying to pick the correct one.
(There are other parts of the code checking it too).

Sorry, something went wrong.

Uh oh!

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

All reactions

@Neenu1995 Neenu1995 Sep 22, 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.

That comment needed correcting. The withSessionId method is only ever called with session ID in the SessionState is already null, that also means there is no sessionID in queryProperties either. So when withSessionID is called, there is no duplicates to drop. I refined the comment and the code to eliminate unnecessary checks.

Sorry, something went wrong.

Uh oh!

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

All reactions

@Neenu1995 Neenu1995 Sep 22, 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.

The exact scenario you mentioned is already handled in getSessionPropertyFromQueryProperties and it throws error in duplicates.

Sorry, something went wrong.

Uh oh!

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

All reactions
@Neenu1995
address comments
2d19a52
@Neenu1995
Neenu1995 requested a review from logachev September 23, 2026 14:16
logachev
logachev approved these changes Sep 25, 2026
View reviewed changes
@Neenu1995
Neenu1995 merged commit 5bd4520 into main Sep 25, 2026
201 checks passed

Uh oh!

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

@Neenu1995
Neenu1995 deleted the fix-session-abort branch September 25, 2026 22:14
@release-please release-please Bot mentioned this pull request Sep 30, 2026
chore(main): release 1.93.0 #14552
Merged
blakeli0 pushed a commit that referenced this pull request Sep 30, 2026
@release-please
chore(main): release 1.93.0 (#14552)
976d588
🤖 I have created a release *beep* *boop*
---


<details><summary>1.93.0</summary>

##
[1.93.0](v1.92.0...v1.93.0)
(2026-09-30)


### ⚠ BREAKING CHANGES

* **automl:** remove java-automl library
([#14540](#14540))

### Features

* **automl:** remove java-automl library
([#14540](#14540))
([6f13a1d](6f13a1d))
* **bigquery-jdbc:** infer undeclared fields in PreparedStatement
([#14400](#14400))
([e989a72](e989a72))
* **gax,gapic-generator-java:** retry start upload call and rename
ResumableUploadCallSettings to ResumableUploadOptions
([#14511](#14511))
([98c2073](98c2073))
* **gax:** add chunk upload recovery loop for resumable uploads
([#14424](#14424))
([8ecd1e5](8ecd1e5))
* **gax:** add ResumableUploadProgressListener and related
infrastructure
([#14426](#14426))
([c7f10d8](c7f10d8))
* **gax:** add RewindableStreamBuffer in prep for chunk upload recovery
([#14423](#14423))
([349c315](349c315))
* **gax:** enforce global timeout for resumable uploads
([#14425](#14425))
([3cb9805](3cb9805))
* **gax:** include upload-status header in resumable upload command
response objects
([#14420](#14420))
([23e49c1](23e49c1))
* **gax:** replace InputStream with InputStreamSupplier in resumable
upload public surfaces
([#14521](#14521))
([3c79730](3c79730))
* **gax:** retry chunk upload on transient errors
([#14422](#14422))
([e72365e](e72365e))
* **gax:** treat resumable upload server rejection as terminal
([#14516](#14516))
([b288788](b288788))
* **gax:** wire up ResumableUploadProgressTracker
([#14427](#14427))
([e7ba3e8](e7ba3e8))
* **grpc-gcp:** Add shared fallback state and probing recovery options
to GcpFallbackChannel
([#14013](#14013))
([675f639](675f639))
* **pubsub:** add publish start time to client telemetry header
([#14496](#14496))
([4b6a671](4b6a671))


### Bug Fixes

* **auth:** exclude javax.annotation-api from api-common dependency
([#14538](#14538))
([668fd18](668fd18)),
refs
[#12363](#12363)
* **bigquery-jdbc:** abort session when connection is closed
([#14273](#14273))
([5bd4520](5bd4520)),
refs
[#13922](#13922)
* **storage:** add App Hub storage.googleapis.com prefix to
destination.id
([#14527](#14527))
([0f6f9b5](0f6f9b5))


### Documentation

* Add gRPC Post-Quantum Cryptography Guide
([#14245](#14245))
([340a239](340a239))
* **samples:** add zonal bucket pre-warmed writer pool sample
([#14517](#14517))
([32e6f87](32e6f87))
* **samples:** pre-warm writer pool channels with flush() after open()
([#14537](#14537))
([df06290](df06290))
* update PQC guide to follow standard template format
([#14333](#14333))
([0b969d5](0b969d5))
</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

@logachev logachev logachev approved these changes
@keshavdandeva keshavdandeva Awaiting requested review from keshavdandeva
+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.

bigquery-jdbc: unable to run SQL 'CALL BQ.ABORT_SESSION()'

Uh oh!

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

3 participants

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