You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In an environment using the AWS wrapper driver, we've encountered an intermittent error where calling setReadOnly at the start or end of a transaction triggers the Aurora wrapper's topology, resulting in the error: "Cannot change transaction read-only property in the middle of a transaction."
Expected Behavior
If not strictly necessary, we recommend that the setReadOnly function should avoid executing the topology call, or that the topology function be executed only after the connection is fully established.
What plugins are used? What other connection properties were set?
failover,efm
Current Behavior
Based on our direct analysis of the methods, we’ve inferred the following:
Topology queries are intermittently executed at the end of a transaction.
These queries are executed within the AWS-provided JDBC wrapper driver.
The setReadOnly method in JDBC cannot be called during a transaction.
Given these points, we hypothesize that the error occurs in the following sequence:
Transaction ends.
TransactionState changes to IDLE.
Under certain conditions, a topology query is executed.
TransactionState changes back to OPEN.
setReadOnly method is called.
Error occurs.
Reproduction Steps
When the setReadOnly function is executed repeatedly, the error described above occasionally occurs.
Possible Solution
I’d like to propose that the Aurora wrapper driver don't trigger the topology call by default when setReadOnly is invoked.
Thank you for the PR above, although it was submitted by someone not directly related to me. I wanted to talk over about this issue if this behavior was intended or not. And why Connection.setReadOnly was included in METHODS_REQUIRING_UPDATED_TOPOLOGY list. Thanks for reviewing this issue.
Thank you for reaching out and raising this issue. We'll take a look at this and keep you updated as we investigate.
Would you be able to provide driver logs that shows a stack trace of the issue?
If it's possible, could you also provide a sample app that reproduces the issue?
As a possible solution for the reported issue, we can suggest to replace failover plugin by failover2. This new failover2 plugin doesn't use driver connection to update a cluster topology, so it can't cause any side effects on a current transaction.
Describe the bug
In an environment using the AWS wrapper driver, we've encountered an intermittent error where calling
setReadOnly
at the start or end of a transaction triggers the Aurora wrapper's topology, resulting in the error: "Cannot change transaction read-only property in the middle of a transaction."Expected Behavior
If not strictly necessary, we recommend that the
setReadOnly
function should avoid executing the topology call, or that the topology function be executed only after the connection is fully established.What plugins are used? What other connection properties were set?
failover,efm
Current Behavior
Based on our direct analysis of the methods, we’ve inferred the following:
setReadOnly
method in JDBC cannot be called during a transaction.Given these points, we hypothesize that the error occurs in the following sequence:
TransactionState
changes toIDLE
.TransactionState
changes back toOPEN
.setReadOnly
method is called.Reproduction Steps
When the
setReadOnly
function is executed repeatedly, the error described above occasionally occurs.Possible Solution
I’d like to propose that the Aurora wrapper driver don't trigger the topology call by default when
setReadOnly
is invoked.Referencing the code in question: SubscribedMethodHelper.java, line 59.
Additional Information/Context
I'd be happy to create a PR to help fix this issue :)
The AWS Advanced JDBC Driver version used
2.2.3
JDK version used
correctto-17 17.0.9
Operating System and version
macOS 15.0.1 (24A348)
The text was updated successfully, but these errors were encountered: