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
Just like the Exception Override Class that can be provided now to tell Hikari whether to evict a connection that is in use or not, we would like to have a similar concept for connections that are idle in the pool.
Currently the isConnectionDead() method is invoked upon checking out the connection, and also in KeepAlive tasks. If the DB server returns errors we want to ignore (just like in the Exception Override Class) we cannot do this currently (testing on Hikari 5.0.1).
This would enable us to run Hikari with the custom AWS JDBC driver and RDS Aurora (MySQL) and cleanly support failover between nodes. Currently Aurora returns special SQLExceptions to initiate failover in the driver, and after the underlying connection is correctly reconnected, Hikari decides to close the connection because of the error. We see something like this in the logs:
13 [2023-03-27 16:58:35 751] [WARNING] HikariPool-1 - Failed to validate connection software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionImpl@68878f6d (The active SQL connection has changed due to a connection failure. Please re-configure session state if required.). Possibly consider using a shorter maxLifetime value.
14 [2023-03-27 16:58:35 754] [FINE ] HikariPool-1 - Closing connection software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionImpl@68878f6d: (connection is dead)
This causes problems with Aurora because Hikari tries to reconnect using a cluster endpoint which, due to most likely caching, sometimes reconnects to the wrong node.
in isConnectionDead() solves the issues that we see during failover. We are requesting that there be a configurable option for this or potentially just using the Exception Override class to make the decision.
This PR is similar to our request: #2045 and would solve this issue.
Just like the Exception Override Class that can be provided now to tell Hikari whether to evict a connection that is in use or not, we would like to have a similar concept for connections that are idle in the pool.
Currently the
isConnectionDead()
method is invoked upon checking out the connection, and also in KeepAlive tasks. If the DB server returns errors we want to ignore (just like in the Exception Override Class) we cannot do this currently (testing on Hikari 5.0.1).This would enable us to run Hikari with the custom AWS JDBC driver and RDS Aurora (MySQL) and cleanly support failover between nodes. Currently Aurora returns special SQLExceptions to initiate failover in the driver, and after the underlying connection is correctly reconnected, Hikari decides to close the connection because of the error. We see something like this in the logs:
13 [2023-03-27 16:58:35 751] [WARNING] HikariPool-1 - Failed to validate connection software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionImpl@68878f6d (The active SQL connection has changed due to a connection failure. Please re-configure session state if required.). Possibly consider using a shorter maxLifetime value.
14 [2023-03-27 16:58:35 754] [FINE ] HikariPool-1 - Closing connection software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionImpl@68878f6d: (connection is dead)
This causes problems with Aurora because Hikari tries to reconnect using a cluster endpoint which, due to most likely caching, sometimes reconnects to the wrong node.
Simply adding something like this:
in isConnectionDead() solves the issues that we see during failover. We are requesting that there be a configurable option for this or potentially just using the Exception Override class to make the decision.
This PR is similar to our request: #2045 and would solve this issue.
Link to the AWS driver project: https://github.com/awslabs/aws-mysql-jdbc
The text was updated successfully, but these errors were encountered: