aws-mysql-jdbc
aws-mysql-jdbc copied to clipboard
Even when there is no failure in aws, it shows connection failure.
I am getting this error very frequently after integrating AWS Jdbc driver v1.0 to spring boot application that uses hikari. Whenever it occur api calls takes much more time but there is no api call fail as such.
cc_config_pool_ro - Connection software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ConnectionImpl@6bb5d3e7 marked as broken because of SQLSTATE(08S02), ErrorCode(0)
java.sql.SQLException: The active SQL connection has changed due to a connection failure. Please re-configure session state if required.
java.sql.SQLException: The active SQL connection has changed due to a connection failure. Please re-configure session state if required.
at s.a.r.j.m.s.c.m.c.j.h.p.f.FailoverConnectionPlugin.failover(FailoverConnectionPlugin.java:500)
at s.a.r.j.m.s.c.m.c.j.h.p.f.FailoverConnectionPlugin.connectToWriterIfRequired(FailoverConnectionPlugin.java:771)
at s.a.r.j.m.s.c.m.c.j.h.p.f.FailoverConnectionPlugin.performSpecialMethodHandlingIfRequired(FailoverConnectionPlugin.java:1154)
at s.a.r.j.m.s.c.m.c.j.h.p.f.FailoverConnectionPlugin.execute(FailoverConnectionPlugin.java:251)
at s.a.r.j.m.s.c.m.c.j.h.p.ConnectionPluginManager.execute(ConnectionPluginManager.java:133)
at s.a.r.j.m.s.c.m.c.j.ha.ConnectionProxy.invoke(ConnectionProxy.java:188)
at com.sun.proxy.$Proxy181.setReadOnly(Unknown Source)
at com.zaxxer.hikari.pool.ProxyConnection.setReadOnly(ProxyConnection.java:423)
at c.z.hikari.pool.HikariProxyConnection.setReadOnly(HikariProxyConnection.java)
at o.s.jdbc.datasource.DataSourceUtils.resetConnectionAfterTransaction(DataSourceUtils.java:252)
at o.s.o.j.v.HibernateJpaDialect$SessionTransactionData.resetSessionState(HibernateJpaDialect.java:399)
at o.s.orm.jpa.vendor.HibernateJpaDialect.cleanupTransaction(HibernateJpaDialect.java:236)
at o.s.orm.jpa.JpaTransactionManager.doCleanupAfterCompletion(JpaTransactionManager.java:614)
at o.s.t.s.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:1004)
at o.s.t.s.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:790)
at o.s.t.s.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:711)
at o.s.t.i.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:633)
at o.s.t.i.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:386)
at o.s.t.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118)
at o.s.a.f.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:1...
Thanks for the report. Do. you have any more information to share with us to help diagnose this?
This error is intermittent, for most of the API calls we don't see any problem but for some, it shows this and takes time. We raised the aws support case and they told us to capture this exception SQLSTATE(08S02) and avoid good connection eviction. They told to refer this. https://github.com/awslabs/aws-mysql-jdbc#connection-pooling
But this exception is internally managed by hikari. We are able to capture other exceptions related to hikari not this one. If you can guide us on how to capture this exception, we can try that. Thanks.
Did you implement the HikariCPSQLException interface as suggested in the https://github.com/awslabs/aws-mysql-jdbc/blob/main/README.md ?