AWS kubernetes connection reset after 11 minutes

606 views Asked by At

When performing a jdbc connection and the transaction taking longer than 11 minutes, connection reset occurs in the Kubernetes, AWS spring boot Java application.

The same Spring boot program, when launched from on-perm, functions well.

Due to the DB's continued on-premises operation, there was already a latency issue.

Find the below error

WARN com.zaxxer.hikari.pool.ProxyConnection - HikariPool-1 - Connection oracle.jdbc.driver.T4CConnection@54ef7 marked as broken because of SQLSTATE(08006), ErrorCode(17002) java.sql.SQLRecoverableException: IO Error: Connection reset WARN org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 17002, SQLState: 08006 ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper

  • IO Error: Connection reset Caused by: java.sql.SQLRecoverableException: IO Error: Connection reset

Our program tries to retrieve more substantial data from the database and write it to binary file.

1

There are 1 answers

0
BEN SEBASTIAN On

when retrieving bigger amounts of data, the connection remains open without transmitting any information (often because the DB is still busy). The problem is caused by NAT-GATEWAY. nat-gateway on AWS terminates any connection with no data after 350 seconds.

Two solutions

  1. Change the default TCP behavior in the kernel
  2. Change the jdbc connector settings

enter image description here

https://docs.aws.amazon.com/vpc/latest/userguide/nat-gateway-troubleshooting.html#nat-gateway-troubleshooting-timeout

jdbc settings: https://docs.oracle.com/en/database/oracle/oracle-database/21/jajdb/oracle/jdbc/OracleConnection.html