-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix communication failures with aws-secretsmanager-jdbc #1932
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: dev
Are you sure you want to change the base?
Conversation
Using aws-secretsmanager-jdbc with HikariCP triggers sporadic communication link failures with MySQL. aws-secretsmanager-jdbc library provides JDBC drivers to retrieve DB credentials, host and password from the Amazon Secrets Manager. See: - https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieving-secrets_jdbc.html - https://github.com/aws/aws-secretsmanager-jdbc By specifying the secret id as a JDBC an URL, and com.amazonaws.secretsmanager.sql.AWSSecretsManagerMySQLDriver as JDBC driver, HikariCP can connect to the MySQL endpoint. But in this stituation, communication link failures occur: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet successfully received from the server was 5,006 milliseconds ago. The last packet sent successfully to the server was 5,007 milliseconds ago. These failures are due a MySQL bug: http://bugs.mysql.com/bug.php?id=75615 which is bypassed by HikariCP when the MySQL driver is used. See: - brettwooldridge#236 - 8af2bc5 (Fix brettwooldridge#236 via workaround for MySQL issue http://bugs.mysql.com/bug.php?id=75615, 2015-01-24) This commit applies the same hack for AWSSecretsManagerMySQLDriver.
b027d98 to
334a93c
Compare
| (jdbcUrl != null && jdbcUrl.contains("mysql")) || | ||
| (dataSource != null && dataSource.getClass().getName().contains("Mysql"))) { | ||
| (dataSource != null && dataSource.getClass().getName().contains("Mysql")) || | ||
| "com.amazonaws.secretsmanager.sql.AWSSecretsManagerMySQLDriver".equals(driverClassName)) { |
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 your case, what is the dataSource classname? Does it contain the name "MySQL", if so the existing contains("Mysql") maybe should just be changed to a case insensitive check.
6d319ab to
7cacd0f
Compare
|
@CodiumAI-Agent /improve |
PR Code Suggestions ✨
|
d7a9b2f to
e56fa46
Compare
See commit message.