-
Notifications
You must be signed in to change notification settings - Fork 27
[PECOBLR-954] Close statements based on Execute Statement Response SEA #1109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -107,8 +107,12 @@ public void close() throws SQLException { | |||||||||||||||||
| @Override | ||||||||||||||||||
| public void close(boolean removeFromSession) throws DatabricksSQLException { | ||||||||||||||||||
| LOGGER.debug("public void close(boolean removeFromSession)"); | ||||||||||||||||||
|
|
||||||||||||||||||
| if (statementId == null) { | ||||||||||||||||||
| if (isClosed) { | ||||||||||||||||||
| if (resultSet != null) { | ||||||||||||||||||
| this.resultSet.close(); | ||||||||||||||||||
| this.resultSet = null; | ||||||||||||||||||
| } | ||||||||||||||||||
|
||||||||||||||||||
| } | |
| } | |
| if (removeFromSession) { | |
| this.connection.closeStatement(this); | |
| } | |
| shutDownExecutor(); | |
| this.isClosed = true; | |
| return; |
Copilot
AI
Dec 3, 2025
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 markAsClosed() method is not synchronized, but it modifies shared state (isClosed) and calls methods that may have concurrency implications. If this method can be called from multiple threads (e.g., during statement execution and timeout handling), it could lead to race conditions. Consider adding synchronization or documenting thread-safety assumptions.
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.
When
resultSet.close()throws an exception in theisClosedbranch, the exception propagates without settingisClosedflag or logging. The normal close path has better error handling. Consider wrapping this in a try-catch to ensure the statement remains in a consistent state even if result set closure fails.