Closed testereg closed 2 months ago
Any update on this? This is what I found:
In the MySQLExceptionHandler.isLoginException(final Throwable throwable) method, we currently retrieve the SQLState from the wrapper exception (SQLNonTransientConnectionException). I believe it would be more accrutate to use the rootCause of the SQLNonTransientConnectionException instead, which should resolve the issue.
Hi @testereg, thank you for reaching out and raising this issue. I'll be taking a look at this to test out your proposed fix. You mention that to reproduce the issue you have to "run the request" and then "wait a while based on the Hikari configuration". I have a couple of related questions:
Thanks for your patience!
@aaron-congo We are running RDS Aurora PostgreSQL, and the snapshot version fixed the issue for us.
I hope it will be published officially soon! Thank you for your effort on this issue.
@Clete2 Glad to hear that worked for you! We are aiming for a release by this Thursday.
Hi @Clete2, we just released this fix in version 2.4.0. I'll close this issue now that the fix is in 2.4.0, since you mentioned the snapshot version fixed the issue for you, but please feel free to reopen or to open a new issue if you encounter any problems. Thanks!
Thank you @aaron-congo ! We will upgrade.
Describe the bug
the following codes in MySQLExceptionHandler.java return false which is supposed to be true when the exception was root caused by a staled password.
public boolean isLoginException(final Throwable throwable) { Throwable exception = throwable;
}
since it returns false, which causes AwsSecretsManagerConnectionPlugin to not do the forceReFetch from secretManger.
I made some changes in the class to fix it in my local. but want to make sure this is a bug. Thanks!
Daniel
Expected Behavior
if the return is true, the AwsSecretsManagerConnectionPlugin will do forceRefectch to get the new password for the connection.
What plugins are used? What other connection properties were set?
autoReconnect=true&serverTimezone=UTC&enabledTLSProtocols=TLSv1.2&wrapperPlugins=auroraConnectionTracker,failover,efm2,awsSecretsManager&wrapperDialect=aurora-mysql&exception-override-class-name=software.amazon.jdbc.util.HikariCPSQLException
Current Behavior
Make sure that there is a MySQL server running on the machine/port you are trying to connect to and that the machine this software is running on is able to connect to this host/port (i.e. not firewalled). Also make sure that the server has not been started with the --skip-networking flag.
Caused by: com.mysql.cj.exceptions.UnableToConnectException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) Caused by: com.mysql.cj.exceptions.UnableToConnectException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Caused by: java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:102) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:81) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:55) Caused by: java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Caused by: com.mysql.cj.exceptions.CJException: Access denied for user 'dwu-cpa'@'172.22.1.186' (using password: YES) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) Caused by: com.mysql.cj.exceptions.CJException: Access denied for user 'dwu-cpa'@'172.22.1.186' (using password: YES)
08-08-2024 17:03:10.319 http-nio-8899-exec-1 [DEBUG] CustomUserInfoTokenServices - Getting user info
Reproduction Steps
run the request, wait a while based on the Hikari configuration, and then rotate the secret.
Possible Solution
fix the following codes in MySQLExceptionHandler.java
public boolean isLoginException(final Throwable throwable) { Throwable exception = throwable;
}
Additional Information/Context
No response
The AWS Advanced JDBC Driver version used
JDK version used
daniel.wu@CAI-X66N2NCY71 cpa % java -version openjdk version "17.0.11" 2024-04-16 OpenJDK Runtime Environment Homebrew (build 17.0.11+0) OpenJDK 64-Bit Server VM Homebrew (build 17.0.11+0, mixed mode, sharing)
Operating System and version
Apple M2 Pro Sonoma 14.5