c3p0 - hibernate 4 session connection remains open -
i use hibernate mysql database in java application migrate hibernate 3 hibernate 4 in new hibernate number of busy thread increased , use of connections application stop working , can not give connection more. hibernate.cfg configuration bellow:
<property name="dialect">org.hibernate.dialect.mysqldialect</property> <!-- enable hibernate's automatic session context management --> <property name="current_session_context_class">thread</property> <property name="hibernate.current_session_context_class">thread</property> <!-- disable second-level cache --> <property name="hibernate.cache.use_second_level_cache">true</property> <!--<property name="hibernate.cache.provider_class"> net.sf.ehcache.hibernate.ehcacheprovider </property>--> <property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.singletonehcacheregionfactory</property> <property name="hibernate.cache.use_query_cache">true</property> <!--<property name="hibernate.generate_statistics">true</property>--> <!--c3p0 configure--> <property name="hibernate.connection.provider_class"> org.hibernate.connection.c3p0connectionprovider </property> <property name="hibernate.c3p0.acquire_increment">3</property> <property name="hibernate.c3p0.idle_test_period">144</property> <property name="hibernate.c3p0.timeout">60</property> <property name="hibernate.c3p0.max_size">30</property> <property name="hibernate.c3p0.min_size">3</property> <property name="hibernate.c3p0.max_statements">0</property> <property name="hibernate.c3p0.preferredtestquery">select 1;</property> <property name="hibernate.c3p0.validate">true</property> <property name="hibernate.c3p0.testconnectiononcheckout">true</property>
i set timeout small value , increase max_size , set use_second_level_cache=false no improvement made
what problem
thanks lot
so sounds connection leak in application. use c3p0 config params unreturnedconnectiontimeout
, debugunreturnedconnectionstacktraces
debug it.
see here.
(in hibernate.cfg they'd hibernate.c3p0.unreturnedconnectiontimeout
, hibernate.c3p0.debugunreturnedconnectionstacktraces
.)
Comments
Post a Comment