HikariPool-1 - Connection is not available, request timed out after 30002ms.

1.确认配置:

 hikariDataSource.setIdleTimeout(60000); 
hikariDataSource.setConnectionTimeout(60000);
hikariDataSource.setValidationTimeout(3000);
hikariDataSource.setLoginTimeout(5);
hikariDataSource.setMaxLifetime(60000);

2. 确认sqlSession 有没有被最终关闭。catch后加入finally{SqlSession.close()}


3. I managed to fix it finally. The problem is not related to HikariCP.The problem persisted because of some complex methods in REST controllers executing multiple changes in DB through JPA repositories. For some reasons calls to these interfaces resulted in a growing number of "freezed" active connections, exhausting the pool. Either annotating these methods as@Transactional or enveloping all the logic in a single call to transactional service method seem to solve the problem.

最后我设法修复这个问题,发现和HikariCP无关。问题依然存在的原因是一些复杂的方法在其他控制器通过JPA存储多个数据库的造成的。由于某种原因调用这些接口导致越来越多的“冻结”活动连接,耗尽连接池。注释所调用的事务服务中如@Transactional中包含事务的所有逻辑的方法中解决这个问题。

参考链接:https://stackoverflow.com/questions/32968530/hikaricp-connection-is-not-available

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值