sehugg
sehugg

Reputation: 3605

Tomcat 6 connection pool goes wacky when CMS GC is used

We recently changed to the CMS garbage collector on our server (XX:+UseConcMarkSweepGC) which worked fine in tests. When we went to production, things were OK for the first few hours, but then we suddenly began to see the dreaded:

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection,
pool error Timeout waiting for idle object

We have seen these messages when the database is physically down or heavily loaded, but this wasn't the case this time. So I began wondering if the recent GC change might be the culprit.

What I don't understand is why we haven't seen this before. Would the change of GC to concurrent-mark-sweep change something (finalizers, perhaps) that would expose problems with this configuration?

My context.xml params look something like this:

<Resource name="jdbc/DB" auth="Container" type="javax.sql.DataSource"
           maxActive="64" maxIdle="60" maxWait="10000"
            defaultAutoCommit="false"

I read this link and began wondering if these were incredibly naive parameters. From my understanding, above 60 connections we will start opening and closing connections without returning them to the pool. But I don't still understand if there is a connection between this and our GC change.

We're using Tomcat 6.0.29 with the MySQL 5.1.45 (5.1.12 JDBC connector).

Upvotes: 2

Views: 1199

Answers (2)

vaibhav
vaibhav

Reputation: 21

use removeAbandoned="true" when you are initializing your connection-pool. Follow the this link http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html

Upvotes: 2

cherouvim
cherouvim

Reputation: 31903

60 connections is way to much. What kind of application do you run?

In any case I highly suggest moving away from dbcp and using something like http://sourceforge.net/projects/c3p0/

Upvotes: 0

Related Questions