简体   繁体   中英

MySQL connection doesnt close by C3P0

We are using MySQL database along with C3P0ComboPooledDataSource for pooling. Below are the configuration:

minPoolSize=10
maxPoolSize=50
maxStatements=50
idleConnectionTestPeriod=3600
acquireIncrement=5
maxIdleTime=600
numHelperThreads=6
unreturnedConnectionTimeout=3600
maxIdleTimeExcessConnections=600

As per document after maxIdleTime the connection should close automatically, and this happens when we debug locally. But on production server we see the MySQL connection count (show processlist) exceeds more than 50 and they are in sleep mode from last 2400 seconds, ideally which should get closed after 600 seconds.Due to this the application is not able to establish connection through pooled data source as it exceeds maxPoolSize. Please let me know what can be done in order to debug this and how can we resolve it.

This is almost certainly a Connection leak. Please be sure to reliably close your Connections, ideally using something like the try-with-resources .

If you don't understand where your application is not reliably closing Connnections See eg C3P0 Spring Hibernate: Pool maxed out. How to debug?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM