Hibernate version: 3
Hi there,
I am having major problem with unreleased mysql connections, and I think it could be one or more from the following:
1) each time I reload the project in tomcat, connections pool remains in memory with all the connections sleeping.
2) connections are not released in my source code. I am pretty sure that I am closing them though. In addition I have some config settings (see applicationContext.xml below) to force close.
3) My configuration settings in applicationContext.xml are not effective and hence there are no real limitations on connection pool, idle time, etc.
Can someone please help me with a few hints on how I can debug this issue. My mysql server crashed several times during development because of the enormous number of mysql threads opened by my project.
Below are some details that may help you help me :)
I appreciate all replies!
Thanks,
applicationContext.xml
=================
Code:
...
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://10.1.1.100/projectx" />
<property name="username" value="root" />
<property name="password" value="asdfasdf" />
<property name="maxActive" value="5" />
<property name="maxIdle" value="5" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>
...
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>hibernate/member.hbm.xml</value>
<value>hibernate/usergroup.hbm.xml</value>
<value>hibernate/dataservice.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<!-- Use the C3P0 connection pool provider -->
<!-- This hasn't been tested. TODO: Test connection pool -->
<prop key="hibernate.c3p0.min_size">1</prop>
<prop key="hibernate.c3p0.max_size">10</prop>
<prop key="hibernate.c3p0.timeout">100</prop>
<prop key="hibernate.c3p0.max_statements">0</prop>
<prop key="hibernate.c3p0.idle_test_period">30</prop>
<prop key="hibernate.connection.release_mode">after_statement</prop>
<prop key="hibernate.connection.aggressive_release">true</prop>
</props>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
...
MySQL growing processlist:
===================
| NULL |
| 82 | root | irene.mydomain.local:4107 | db | Sleep | 1214 |
| NULL |
| 402 | root | apple.mydomain.local:3176 | NULL | Query | 0 |
NULL | SHOW PROCESSLIST |
| 551 | root | apple.mydomain.local:3302 | projectx | Sleep | 1303 |
| NULL |
| 553 | root | apple.mydomain.local:3305 | projectx | Sleep | 1302 |
| NULL |
| 555 | root | apple.mydomain.local:3310 | projectx | Sleep | 1301 |
| NULL |
| 559 | root | apple.mydomain.local:3314 | projectx | Sleep | 1297 |
| NULL |
| 561 | root | apple.mydomain.local:3316 | projectx | Sleep | 1296 |
| NULL |
| 563 | root | apple.mydomain.local:3318 | projectx | Sleep | 1296 |
| NULL |
| 567 | root | apple.mydomain.local:3322 | projectx | Sleep | 1293 |
| NULL |
| 569 | root | apple.mydomain.local:3324 | projectx | Sleep | 1292 |
| NULL |
| 571 | root | apple.mydomain.local:3326 | projectx | Sleep | 1264 |
| NULL |
| 652 | root | apple.mydomain.local:3552 | projectx | Sleep | 894 |
| NULL |
| 654 | root | apple.mydomain.local:3554 | projectx | Sleep | 894 |
| NULL |
| 656 | root | apple.mydomain.local:3556 | projectx | Sleep | 894 |
| NULL |
| 658 | root | apple.mydomain.local:3558 | projectx | Sleep | 892 |
| NULL |
| 660 | root | apple.mydomain.local:3561 | projectx | Sleep | 891 |
| NULL |
| 662 | root | apple.mydomain.local:3570 | projectx | Sleep | 890 |
| NULL |
| 664 | root | apple.mydomain.local:3573 | projectx | Sleep | 890 |
| NULL |
+-----+------+----------------------------------+-------------+---------+------+
-------+------------------+
23 rows in set (0.00 sec)
mysql>