-
Notifications
You must be signed in to change notification settings - Fork 69
fix: statement cancel not working with mysql driver #851
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
Conversation
e475195
to
452c28e
Compare
wrapper/src/test/java/integration/container/tests/MysqlTests.java
Outdated
Show resolved
Hide resolved
wrapper/src/main/java/software/amazon/jdbc/ConnectionPluginManager.java
Outdated
Show resolved
Hide resolved
893145b
to
bc9b8ee
Compare
bc9b8ee
to
452cc9c
Compare
fc910bc
to
c3b4ff2
Compare
wrapper/src/test/java/software/amazon/jdbc/util/WrapperUtilsTest.java
Outdated
Show resolved
Hide resolved
@@ -251,7 +260,9 @@ public static <T, E extends Exception> T executeWithPlugins( | |||
} | |||
|
|||
} finally { | |||
pluginManager.unlock(); | |||
if (lock.isHeldByCurrentThread()) { |
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 wonder if the unlock should happen after calling closeContext. Can you check with @sergiyvamz
|
||
public class AsynchronousMethodsHelper { | ||
public static final List<String> ASYNCHRONOUS_METHODS = Collections.singletonList( | ||
"Statement.cancel" |
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.
What about other variations of statement.cancel? e.g. PreparedStatement.cancel
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.
Good point, it's been added to the list
c3b4ff2
to
61b3c1d
Compare
61b3c1d
to
f2d7a06
Compare
Summary
Statement cancel not working with MySQL driver
Description
The Statement.cancel method currently does not function with the MySQL community driver due to locking the ConnectionPluginManager. The MySQL driver also synchronizes on the Statement.getConnection method, which blocks any Statement.cancel executions. This PR moves the lock location and skips executing Statement.getConnection when running Statement.cancel.
Additional Reviewers
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.