AroundAround
Sign in Sign up
Menu
  • Home
    • Home
  • Blog
    Technology
    All Technology Software Engineering Web Applications Java Spring Framework Spring Boot AWS
    All Posts
    Smash Posts Transportation Posts Driving Posts Multi Location Post
    Transport
    Driving Articles Driving License Resources Refresh Drive Success Stories Special Articles
    Research
    Popular lists Weblogs Tutorials
    News
    Education Health Sports
    Traffic Signs
    Dubai Traffic Signs Qatar Traffic Signs Abu Dhabi Traffic Signs Saudi Arabia Traffic Signs Kuwait Traffic Signs Kerala Traffic Signs
  • Insights
    Interview Series
    All Interview Series Java Questions Spring Questions Microservices Questions Database Questions
    Lifestyle
    Umrah Articles Dubai UAE visa 180 days calculator Qatar residence visa 180 days calculator Prayer Time Malappuram Sqm to Cent calculator Kerala
    City Explorer
    Sulthan Bathery
  • Mock Tests
    Driving
    Test Home
    Dubai
    RTA Theory Test Parking Knowledge Test Deep-dive Assessment Test
    Abu Dhabi
    RTA Driving Theory Test Deep-dive Assessment Test Saudi Arabia Computer Test
    Other Regions
    Qatar Driving Theory Test Kuwait Driving Theory Test Ajman RTA Theory Test Sharjah RTA Theory Test Bahrain Driving Theory Test Learners License Test - Kerala
    Education
    Kindergarten School
  • Course & Videos
    • CoursesEnroll today
    • Videos20+Watch & Subscribe
  • Questions and Tags
    Topics
    Don't miss Million dollar questions Million Views Day to day life Interview Junky Trendy questions Theory wizard
    Technology
    Java Spring AWS
    Find the differences
    All Find the differences List
    Tags
    macOS AWS Spring
  • About Us
    • Privacy Policy
    • Contact
    • Terms & Conditions
    • Cancellation & Refund Policy
    • Shipping & Delivery Policy
  1. Home
  2. spring-boot
  3. Post

HikariCP Shutdown Issue in Spring Boot

Emma Brown
admin
#spring-boot #tomcat
Share post:
Share

HikariCP shutdown mid-operation? Your app just died...silently. Debug this cryptic log and save the day. Dive in!

Solution in a Nutshell

Spring Boot HikariCP Shutdown: Preventing Early Shutdown Errors

Spring Boot's HikariCP connection pool can throw java.lang.IllegalStateException: Connection pool shut down if connections are still in use during shutdown. This occurs because HikariCP gracefully closes, but active connections prevent immediate termination.

Solution: Increase the shutdown timeout. HikariCP provides spring.datasource.hikari.shutdown-timeout (in milliseconds) to extend the graceful shutdown period. This allows outstanding connections to complete before pool closure.

Example application.yml:

spring:
  datasource:
    hikari:
      shutdown-timeout: 30000 # 30 seconds

Code Example (Java config):

@Configuration
public class DataSourceConfig {
    @Bean
    public DataSource dataSource(DataSourceProperties properties) {
        HikariConfig config = properties.getHikariConfig();
        config.setShutdownTimeout(30000); // 30 seconds
        return new HikariDataSource(config);
    }
}

Troubleshooting:

If the error persists, investigate:

  • Long-running transactions: Ensure transactions are properly managed and don't hold connections unnecessarily.
  • Connection leaks: Identify and fix any code that fails to close connections. Use try-with-resources for automatic closure.
  • Insufficient timeout: Increase shutdown-timeout further if necessary. Observe application shutdown logs for connection details.

By adjusting the shutdown timeout and addressing potential connection leaks, you can prevent HikariCP's premature shutdown errors in your Spring Boot application.

Sidebar

Search

Tags

#spring-boot #tomcat

Trending posts

Post

HikariCP Shutdown Issue in Spring Boot

Post

Spring Boot REST Client

Post

Date Range Check with Spring Data JPA

Post

Spring Boot Spring Version Upgrade

  • Contact Us
  • Privacy Policy

© Copyright - smashplus 2013-25.