Are you sure you're not leaking Connections somewhere?
Try setting c3p0-0.9.1's unreturnedConnectionTimeout and debugUnreturnedConnectionStackTraces properties (in a c3p0.properties file for hibernate < 3.2.2, in a c3p0.properties file or your hibernate config for hibernate 3.2.2+, please verify that your settings have taken effect by looking at c3p0's config dump in your logs). If you see unreturnedConnections timing out, then there is likely some circumstance in which you are somehow not closing a Connection. If debugUnreturnedConnectionStackTraces is true, you'll see stack traces showing how the unreturned Connections were originally checked out, giving you a strong clue about where you need to tighten up Connection cleanup.)
Of course, your clean-up may be fine, and your problem may be something else entirely. But indefinite hangs after a reliable first bunch of Connections sounds a lot some of that first bunch of Connections didn't get closed.
If you have access to JMX, you might check whether the number of busy Connections is the same as maxPoolSize when your application hangs. If you don't, messing around with different settings of maxPoolSize might help: if there is a resource leak, then the smaller maxPoolSize, the more quickly your app will hang.
Good luck!
Steve
|