1 问题描述
Web程序在tomcat刚开始运行时速度很快,但过一段时间后发现速度变得很慢。
检查日志输出,发现异常如下:
org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted, cause:
java.util.NoSuchElementException: Timeout waiting for idle object
2 问题解决
tomcat 的数据源定义提供了三个参数:
a. 如果设为true则tomcat自动检查恢复重新利用,没有正常关闭的Connection.(默认是false)
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
b. 设定连接在多少秒内被认为是放弃的连接,即可进行恢复利用。
<parameter>
<name>removeAbandonedTimeout</name>
<value>60</value>
</parameter>
c. 输出回收的日志,可以详细打印出异常从而发现是在那里发生了泄漏
<parameter>
<name>logAbandoned</name>
<value>true</value>
</parameter>
附 spring配置 BasicDataSource的相关参数解释
1 初始化连接
initialSize=10
2 最大空闲连接
maxIdle=20
3 最小空闲连接
minIdle=5
4 最大连接数量
maxActive=50
5 是否在自动回收超时连接的时候打印连接的超时错误
logAbandoned=true
6 是否自动回收超时连接
removeAbandoned=true
7 超时时间(以秒数为单位)
removeAbandonedTimeout=180
8 超时等待时间以毫秒为单位 6000毫秒/1000等于60秒
maxWait=1000
分享到:
相关推荐
dbcp 连接池不合理的锁导致连接耗尽解决方案 ... nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted at org.springframework.jdbc.dataso
主要介绍了阿里dubbo出错提示Thread pool is EXHAUSTED的问题及解决方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
使用spring + atomikos+druid配置的分布式事务demo,两种数据源配置方式都可以,使用junit测试没问题,案例中使用的mysql数据库是8.0.11版本,版本不同请自行修改pom.xml和jdbc.properties
o POOL-152: GenericObjectPool can block forever in borrowObject when the pool is exhausted and a newly created object fails validation. When borrowing an object if a new object is created but ...
主要介绍了Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2611816 bytes)错误的解决方法,需要的朋友可以参考下
php Allowed memory size of 134217728 bytes exhausted
编译时virtual memory exhausted Cannot allocate memory 内存增加.docx
今天在百度知道看php相关资料时发现一个网友问一个wordpress安装提示错误的一个问题,说他在安装wordpress安装包时遇到这样一个问题:Fatal error:Allowed memory size of 67108864 bytes exhausted (tried to ...
cwb@laptop$ (./a.out | tail -1) & (./a.out | tail -1) mmap: Cannot allocate memory mmap: Cannot allocate memory 121126: Allocated map: 65514, 0x7f93dae09000 121128: Allocated map: 65514, 0x7fbce487...
php解决Allowed memory size of bytes exhausted
云服务器编译安装PHP遇到virtual memory exhausted: Cannot allocate memory
connection pool exhausted connection refuse by peer 一个个来分析。 LOADING Redis is loading the dataset in memory 这里至少有2种可能 可用内存太小,修改 redis.conf 中的 maxmemory 即可解决 redis 在...
S7A驱动,7.20版本, Version history S7A OPC server and FIX driver for Siemens S7/S5 communication via Ethernet TCP/IP, MPI or Profibus Version 7.20 Date: 26.02.2007 ...
现象 在跑 edu_ocr_img 表的归档时,每跑几万个数据,都会报...EduOCRTaskBackup::getDb()->createCommand()->batchInsert(EduOCRTaskBackup::tableName(), $fields, $data)->execute(); execute 之后会造成使用内存
travel time and exhausted gasoline. Most navigation systems use the static shortest path routing algorithm or use optional traffic information broadcasted by a centralized Traffic Information Center ...
有些朋友新配置的环境或自己新写的程序运行时会碰到fatal error: Allowed memory size of 134217728 bytes exhausted错误,这种问题一个是程序写得不好导致的,另一个是环境配置不好也会出现,像php5.1.27+apache2.2.3...
本文实例讲述了ThinkPHP提示错误Fatal error: Allowed memory size的解决方法。...错误提示:Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 523800 bytes) in /var/w