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.  [ 1 post ] 
Author Message
 Post subject: Hanging connections seen by the connection pooling
PostPosted: Tue Aug 24, 2010 5:29 am 
Newbie

Joined: Thu Aug 20, 2009 3:00 am
Posts: 11
Hello,

I'm using Hibernate 3.5.3 with the integrated jpa library for my JSF application. between Hibernate and the MySQL database I'm using c3p0 as suggested by many users. Before c3p0 I used dbcp but that gave exactly the same issues.

The issue is that I see "numBusyConnections" in c3p0 with hanging connections. I clean them from within c3p0 after 1800 seconds (unreturnedConnectionTimeout) but why are they there in the first place? c3p0 lets you dump stacktraces from creation time and so I found out that the connections are "checked out" by my 'long living' entity manager. That entity manager is created as soon as the user wants to change something on the screen and cleared as soon as the changes are submitted by the user and committed to the database. So 'long living' is just a couple of seconds, the time the user needs to read the data and make his changes on the web page.

Problems I see are:
- I'm using one entity manager for all fields on the screen. The browser can request multiple fields simultaneously and so multiple threads do use the same entity manager concurrently for reading data from the database. But I don't think that this could be done differently because the jsf page uses things like #{employee.appointments} and #{employee.phonenumbers}. Those have to access the database through the persistence proxy and do so with multiple theads at the same time.
- bug in entity manager??? This should never leave a connection used after the query is done. It all started as soon as I started using the Hibernate JPA library instead of the ejb3-persistence.jar.

Thank you very much for any help!!! Any pointer where to look is very welcome.

MAG,
Milo v/d Zee


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

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.