-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: c3p0 not closing connections from SesisonFactory's close()
PostPosted: Sat Nov 01, 2003 3:47 pm 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
I'm using Hibernate 2.0.3 with the recommended connection pool C3P0. When my servlet calls the SessionFactory's close() method, the C3P0 pool isn't closing down. It is just getting orphaned so it continues holding on and running up both memory and additional database connections each time I start it up again (Without completely shutting down Tomcat)

Other details include my hibernate.cfg.xml file below and that I'm running Tomcat 4.1.24 and JDK 1.4.2_01.

<hibernate-configuration>
<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory>
<!-- properties -->
<!-- property name="connection.datasource">my/first/datasource</property> -->
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.username">someDBUser</property>
<property name="connection.password">someDBPAss</property>
<property name="connection.url">jdbc:mysql://localhost:3306/someDB?autoReconnect=true</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="show_sql">false</property>
<property name="use_outer_join">true</property>
<property name="transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>
<property name="c3p0.max_size">20</property>
<property name="c3p0.min_size">2</property>
<property name="c3p0.timeout">3600</property>
<property name="c3p0.max_statements">100</property>
<property name="c3p0.valudate">false</property>

<!-- mapping files -->
<mapping resource="Misc.hbm.xml"/>
</session-factory>
</hibernate-configuration>

Thanks for any suggestions.

Regards,
David


Top
 Profile  
 
 Post subject: problem: empty close() function, can any coders fix it?
PostPosted: Sat Nov 01, 2003 4:33 pm 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
CVS Shows the code has no actions in the close() function. And I read this was the preferred connection Pool method?

From the CVS listings for the
net.sf.hibernate.connection.C3P0ConnectionProvider class I got

package net.sf.hibernate.connection;

// CODE REMOVED BY me because it isn't relevant

public class C3P0ConnectionProvider implements ConnectionProvider {

// CODE REMOVED BY me because it isn't relevant
// and there is only one line in the API, a comment that they didn't
// code anything to close C3P0
public void close() {
// no API for closing a c3p0 pool
}
};

Anyone know anything about C3P0 to fix this Hibernate 2.0.3 (and higher)production code?

Regards,
David


Top
 Profile  
 
 Post subject: Received reply from C3P0 creator/but already switched pools
PostPosted: Tue Nov 04, 2003 6:23 pm 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
I'd emailed Steve Waldman about his C3P0 project and got this response about the 0.8.3 C3P0 passed out with Hibernate 2.0.2 & 2.0.3:

---------------
You'll have to upgrade to the latest 0.8.4 test release, but if you do,
you can force DataSources to clean themselves up by calling the static
method DataSources.destroy(DataSource pooledDataSource ), or
equivalently by casting the DataSource to a
com.mchange.v2.c3p0.PooledDataSource and calling its close() method.
---------------

Regardless, yesterday I commented out my C3P0 settings and added
<property name="dbcp.minIdle">1</property>
to my hibernate.cfg.xml files. It got rid of most of my emory problems since C3P0 was eating up memory and never exiting until I shut down Tomcat. I think I still have a leak somewhere but I haven't found it yet (though I'm sure I've freed everything up).

Regards,
David


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.