kyb -- this looks like pool exhaustion, like somewhere you are checking out Connections but not necessarily returning them. You can debug this by upgrading to c3p0-0.9.1-pre11 if you haven't already, and setting the following config parameters in a c3p0 properties file:
Code:
c3p0.unreturnedConnectionTimeout=10
c3p0.debugUnreturnedConnectionStackTraces=true
The first line tells c3p0 to automatically close Connections if your program fails to do so within 10 seconds of checkout. (You might try a different timeout, depends on what your app does.) The second line asks c3p0 to log stack traces of the Connection checkouts for which Connections eventually failed to be checked in. Pay careful attention to these stack traces: they indicate a codepath where Connections are used by the application but not closed 100% reliably.
Be sure you are using Java's reliable resource cleanup idiom to close Connections or Sessions to avoid Connection leaks in a long-running server process. That would be like this:
Code:
Session mySession = null;
try
{
mySession = ...; //however you initialize Sessions
// do some hibernate work...
}
finally
{
try { if (mySession != null) mySession.close(); }
catch(Exception e) { log("Exception on close", e); }
}
Note that if you are working with more than one closable resource,
you must make a SEPARATE, BEST ATTEMPT to close each resource:
Code:
Session mySession = null;
InputStream is = null;
try
{
mySession = ...; //however you initialize Sessions
is = createControlFileInputStream();
// read from the input stream
// do some hibernate work, based on control file...
}
finally
{
try { if (is != null) is.close(); }
catch(Exception e) { log("Exception on close", e); }
try { if (mySession != null) mySession.close(); }
catch(Exception e) { log("Exception on close", e); }
}
Note that the closing of the two separate resources occurs in
distinct try/catch clocks (nested within the finally block). This is
important -- if you put them in a single try/catch (or don't nest
any try/catch blocks), a failure to close() the first resource leads
to a failure to close() the second.
By the way, none of this is c3p0-specific advice. It's widely
applicable good Java hygiene. Connection pool exhaustion is just one
of many ways a failure to close() resources property can manifest
itself.
Good luck!