Troubleshooting 'connection reset by peer' error with Hikari in RDS

Hi there :wave: RDS related question. We are using Hikari in our Java application to connect to RDS. The thing is that we are getting connection reset by peer error (meaning that we are getting RST TCP packet) exactly after the time we can configure by Hikari’s maxLifeTime (this retires connection so it is not able to be borrowed again). So if we set maxLifeTime to 60s then we are getting connection reset by peer at this moment. How can we fix that?

Probably there’s some timeout on rds or between server and db. Maxlifetime should be much longer than a minute generally, that’s the longest it will allow you to keep a connection open - so 60 seconds is quite short

Seems the default is 1800000ms

So recommend to restore that back to default; what other non default settings are you using?

for non standard settings in our connection pool in Java:

idleTimeout = 0 (10 min is default)
maxLifetime = 60s (30 min is default)
connectionTimeout = 15s (30s is default)

keepaliveTime = 0 (same as default)

We are using Aurora 15 with the default settings, except the following ones:

log_min_duration_statement = 500
max_connections = 1024
tcp_keepalives_idle = 0
tcp_keepalives_interval = 0

But I think we were able to narrow it down a bit and we are observing this issue when sslmode is enabled. It is in a way smiliar to this issue here (although this is in the context of port-forwarding): https://github.com/kubernetes/kubectl/issues/1169#issuecomment-1165140134|https://github.com/kubernetes/kubectl/issues/1169#issuecomment-1165140134