debugging loss of connections using 'debugUnreturnedConnectionStackTraces'

Npa picture Npa · Aug 3, 2012 · Viewed 8.8k times · Source

I am working on fixing connection timeouts issues for a project that iam working on. we use c3p0 to manage the connection pool and hibernate as the orm tool. we also use spring.

To find if there any unreturned connections, i have set debugUnreturnedConnectionStackTraces to true in my c3p0 configuration(NOT in c3p0 properties).

Is there anything else that I need to do. Do I have to add anything to my lod4j.properties also or is it just enough to set debugUnreturnedConnectionStackTraces to true?

Also, should i set debugUnreturnedConnectionStackTraces to true in c3p0 properties?

Thanks for the help

Answer

Steve Waldman picture Steve Waldman · Aug 4, 2012

Expanding a bit on Corey's answer:

If unreturnedConnectionTimeout is positive and debugUnreturnedConnectionStackTraces is set to true, then the stack traces that generated unreturned Exceptions will be logged at INFO level by the logger "com.mchange.v2.resourcepool.BasicResourcePool".

Often people log anything above INFO level from all loggers, so these stack traces just appear in your logs. But if you don't see them, do check your logging configuration to make sure messages at INFO from that logger are not filtered.

Note that debugUnreturnedConnectionStackTraces will do NOTHING if unreturnedConnectionTimeout is not also set.

See

http://www.mchange.com/projects/c3p0/#unreturnedConnectionTimeout

http://www.mchange.com/projects/c3p0/#debugUnreturnedConnectionStackTraces

I hope this helps!

p.s. it doesn't matter how you set these properties, as long as they are properly set. c3p0 dumps pool configurations at INFO on pool initiation; check your logs to make sure that, however you are trying to set parameters, you have the configuarion you expect. Alternatively you can use JMX to inspect parameters.