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

setIdleTimeout and setKeepaliveTime are not working with MySQL 8 wait_timeout #2276

Open
jayeshsolankiii opened this issue Dec 20, 2024 · 0 comments

Comments

@jayeshsolankiii
Copy link

Scenario 1

Spring Boot 2.6.3

HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setDriverClassName(dataSourceProperties.getDriver());
hikariConfig.setUsername(dataSourceProperties.getUsername());
hikariConfig.setPassword(dataSourceProperties.getPassword());
hikariConfig.setJdbcUrl(jdbcUrl);
hikariConfig.setMaximumPoolSize(1);
hikariConfig.setMinimumIdle(0);
hikariConfig.setIdleTimeout(5000); //5 Seconds
return new HikariDataSource(hikariConfig);

MySQL 8
wait_timeout = 30 //30 Seconds

As my understanding HikariCP with Spring Boot and MySQL 8, the ideal connection should be removed after 5 seconds, when I check PROCESSLIST in the MySQL it is alive for 30 seconds which is the wait_timout of the MySQL connection.

Scenario 2

hikariConfig.setKeepaliveTime(40000); //40 Seconds

The connection should be alive for 40 seconds but removed in 30 seconds which is the wait_timout of the MySQL connection.

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

1 participant