Could not open JDBC Connection for transaction; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 3000, active 16, maxActive 16"

这个异常可能是因为druid连接池泄漏产生的异常。连接超时,active和maxActive相等,不能够创建新的连接,如果很长时间还获取不到,很有可能是连接池泄漏造成的,而且没有开启druid的超时回收导致的。

添加回收机制后,

#druid recycle
druid.removeAbandoned=true
druid.removeAbandonedTimeout=300
druid.logAbandoned=true
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
配置removeAbandoned对性能会有一些影响,建议怀疑存在泄漏之后再打开。在上面的配置中,如果连接超过300秒未关闭,就会被强行回收,并且日志记录连接申请时的调用堆栈。
GitHub 加速计划 / druid / druid
6
3
下载
阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
最近提交(Master分支:17 天前 )
a71fa6ad - 3 天前
0b375e47 - 10 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐