commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Wingert" <>
Subject [DBCP] connections not properly closed
Date Tue, 30 Sep 2008 15:01:12 GMT
I'm running dbcp 1.2.2 and mysql-connector-java-5.1.6 on a test system.

Just found that the system after running a couple of hours got an
exception in the log files when trying to create a new database
connection: Too many open files

Checked the list of open files (lsof) and got a long list:
java 10659 admin 6u sock 0,4 1555102 can't identify protocol

The PID is the jvm running our system.

Found that the MySQL setting wait_timeout (that closes idle
connections after the configured time) was set to 60 seconds by
accident. So it seems that when MySQL closes an idle connection
somehow the JDBC connection in the database pool isn't closed properly
leaving the file descriptor open (this is a test system so there are
many idle connections).

This is the code I use to setup my pool:

GenericObjectPool m_generic_objectpool = new GenericObjectPool();
ConnectionFactory connectionFactory = new

AbandonedConfig ab_conf = new AbandonedConfig();

String validation_query = new String("SELECT 1");
new PoolableConnectionFactory(connectionFactory,m_generic_objectpool,null,validation_query,false,true,ab_conf);
PoolingDataSource data_source = new PoolingDataSource(m_generic_objectpool);

Thankful for any help

BR // Martin

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

View raw message