commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <>
Subject Re: DBCP abandoned connections piling up, never clearing, reaching max_connections
Date Sat, 27 Mar 2004 17:19:58 GMT
What exactly do you mean with "sleeping", is that a mysql connection 
state or something?

Your approach of having a connection pool in a singleton is fine, no 
obvious problems with it.

Can you post a testcase that fails? Or the relevant parts of your 
code. (but make sure is is complete and easily runnable, in tomcat or 
as junit test)

-- Dirk

Paul Tomsic wrote:

> Tomcat 4.1.30, MySql 4.0.18-standard, dbcp-1.1,mysql
> jdbc 3.0.9
> We're using mysql on a different box than the tomcat.
> The problem we're having is, when we deploy to the box
> using ant, and watch the mysql process list, 5-7
> connections start immediately and stay "sleeping" for
> ever.  Then, every time we make a connection to the DB
> from within the application, it's not being cleaned
> up.  So, new connections are made all the time, and
> never cleaned up, not to mention that the initial 5 or
> so that are started when the app is deployed stay
> sleeping forever.  Within a brief period of heavy
> activity, we have to stop everything, b/c we're out of
> connections.
> We have a class that handles the pool, w/ a private
> instance constructor and the following:
> DriverAdapterCPDS cpds = new DriverAdapterCPDS();
> SharedPoolDataSource tds = new SharedPoolDataSource();
> cpds.setDriver(dbDriver);
> cpds.setUrl(dbUri);
> cpds.setUser(dbUser);
> cpds.setPassword(dbPass);
> tds.setConnectionPoolDataSource(cpds);
> tds.setMaxActive(0);
> tds.setMaxWait(50);
> tds.setTimeBetweenEvictionRunsMillis(20);
> DataSource ds = tds;
> Then there's a method that simply returns
> ds.getConnection() from within that singleton pool
> class.
> When we get a connection, it's wrapped in a
> try/catch/finally where inside the finally we
> conn.close() explicitly.
> Sorry to be long, but anyone have any thoughts?
> thanks in advance.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message