DBCP Tomcat连接池泄漏 [英] DBCP Tomcat connection pool leak

查看:107
本文介绍了DBCP Tomcat连接池泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<Resource name="myConn" auth="Container"
              type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver"
              url="jdbc:oracle:thin:@10.10.10.10.:1521:mydb"
              username="username" password="password" maxActive="500" maxIdle="50"
              maxWait="-1" removeAbandoned="true" removeAbandonedTimeout="60"     logAbandoned="true" accessToUnderlyingConnectionAllowed="true"
/>

我试图找出应用程序中未关闭连接的区域.我在上下文文件中添加了removeAbandoned和logAbandoned子句,但是如果我在oracle上检查v $ session,即使在60秒后仍显示相同数量的活动连接.上面的配置有问题吗?

I am trying to find out areas of the application where connections are NOT being closed. I added the removeAbandoned and logAbandoned clauses in my context file but if i check v$session on oracle it is still showing the same number of connections active even after 60 seconds. Is there something wrong in the configuration above?

推荐答案

我会将 maxActive 设置为较小的值,例如50,然后检查配置是否正常工作.根据文档,连接池必须电量不足以执行废弃连接的检查:

I would set maxActive to smaller value like 50 and then check if the configuration is working correctly. According to the docs the connections pool must running low to execute the check for abandoned connections:

可用的数据库连接不足时DBCP将恢复并回收任何找到了废弃的dB连接.

When available db connections run low DBCP will recover and recycle any abandoned dB connections it finds.

我还将 removeAbandonedTimeout 更改为20,这样您就不必等待很长时间来检查检测器是否工作正常.

I would also changed the removeAbandonedTimeout to 20 so that you won't have to wait to long to check if the detector is working fine.

这篇关于DBCP Tomcat连接池泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆