Hi,

The first thing to be checked is probably your application. If some method does not properly close an SQL connection, you will have a leak that will ultimately lead to this resource exhaustion. To better trace if this is a case, you may for example create a Wrapper of SqlConnection that counts connection creation/close.

Best regards
/Philippe

Eric B. a écrit :
Hi,

I'm having some trouble with my dbcp pool freezing up when running a load, and am having trouble figuring out why. I have enabled JMX on the server and connected via jConsole, and see that all my threads are in the WAITING state from org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:810)

I don't believe I have any connection leaks in my code (I explicity close all my connections in a try/catch/finally), and yet, once all my connections are used up, all processes hang. I have tried enabling removeAbandoned connections, but it doesn't seem to do anything either. If I look at the numActive threads in jConsole, it is always stuck at maxThreads (in my case, 8). Increasing the number of maxThreads will unblock the problem, but it doesn't resolve the underlying question as to why this happens in the first place. I would expect that if some threads are "busy" doing nothing, that they would be cleaned up by the removeAbandoned option, and released to the next available thread.

  <Resource name="jdbc/db" auth="Container"
       type="javax.sql.DataSource" username="db" password="db"
driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/db?autoReconnect=true"
       maxActive="8" maxIdle="4"
       removeAbandoned="true"
        removeAbandonedTimeout="20"
        logAbandoned="true"
    />


Example jConsole thread trace:
Name: http-8112-12
State: WAITING on org.apache.tomcat.dbcp.dbcp.abandonedobjectp...@1cee361
Total blocked: 634  Total waited: 285

Stack trace:
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:474)
org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:810)
org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:84)
org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
...


All the threads just wait in this state perpetually.


I was hoping to go through the source code for the pooling, but I can't seem to find the srcs for tomcat-dbcp.jar anywhere. I realize that they are a subset of the commons-dbcp library, but was wondering if the actual sources that make up tomcat-dbcp exist anywhere. I can't find them anywhere on the tomcat site.

Any ideas, suggestions or pointers would be greatly appreciated.

Thanks!

Eric



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to