Skip to content
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

Hikari CP Connection Recovery Problem After DB Outage #2179

Open
andrea-silva opened this issue Feb 28, 2024 · 2 comments
Open

Hikari CP Connection Recovery Problem After DB Outage #2179

andrea-silva opened this issue Feb 28, 2024 · 2 comments

Comments

@andrea-silva
Copy link

Context:

  1. spring_boot_version = 3.2.0
  2. ojdbc8 version = 21.11.0.0
  3. oracle version = Oracle Database Enterprise Edition Release 19.0.0.0.0
  4. HikaryCP = 5.0.1

The following happened in a few of our test environments (but I cannot reproduce it locally).

After an outage of the DB, the connection pool was not able to recover when the DB was up and running again.
After the spring application is restarted the problem is solved, but a restart should not be necessary in this scenario.

The exception (happening over and over again until the Spring application is restarted) is:

image

When I reproduce the scenario locally (stopping and restarting the DB), the datasource recovers after the DB is restarted.

The problem is the same as described in https://stackoverflow.com/questions/69566390/hikari-cp-spring-boot-connection-recovery-problem-after-db-failure

@KazzmanK
Copy link

KazzmanK commented Mar 8, 2024

We have same issue, triggered by DB outage.
#2161 (comment)

@Donghh0221
Copy link

Donghh0221 commented May 5, 2024

Have you tried setting the socket read timeout for Oracle JDBC? If you don't set the Read Timeout, Oracle's default socket read timeout is null. This means that after a Tomcat thread borrows a connection from the Hikari connection pool, it could infinitely wait for the query result without recovering, after db outage happened.

Refer to this and the HikariCP Rapid Recovery guide: https://github.com/brettwooldridge/HikariCP/wiki/Rapid-Recovery

You can set up your configuration for HikariCP like this:

HikariConfig config = new HikariConfig();
config.setJdbcUrl("jdbc:oracle:thin:@//host:port/serviceName?oracle.net.CONNECT_TIMEOUT=5000&oracle.jdbc.ReadTimeout=30000");
config.setUsername("username");
config.setPassword("password");

HikariDataSource dataSource = new HikariDataSource(config);

Try setting up hikariCP configruation like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants