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

各种问题 专栏收录该内容
3 篇文章 0 订阅

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
    点赞
  • 2
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值