Debugging connection loss using "debugUnreturnedConnectionStackTraces"

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

In order to find if there are any unreturned connections, I set debugUnreturnedConnectionStackTraces to true in my c3p0 configuration (NOT in the c3p0 properties).

Is there anything else I need to do. Should I add anything to my lod4j.properties as well or is it enough to set debugUnreturnedConnectionStackTraces to true?

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

thanks for the help

+6
source share
2 answers

Expand the bit to Corey's answer:

If unverturnedConnectionTimeout is positive, and debugUnreturnedConnectionStackTraces is true, then stack traces that throw unexecuted Exceptions will be logged at the INFO level by the "com.mchange.v2.resourcepool.BasicResourcePool" logger.

Often people log something above the INFO level from all loggers, so these stack traces are only shown in your logs. But if you do not see them, check the logging configuration to make sure that messages in the INFO from this logger are not filtered out.

Note that debugUnreturnedConnectionStackTraces will do nothing if the non-return ConnectionTimeout is also not set.

Cm

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

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

Hope this helps!

ps it doesn't matter how you set these properties if they are set correctly. c3p0 pool configurations in INFO when starting the pool; check your logs to make sure that while you are trying to set the parameters, you have the configuration that you expect. Alternatively, you can use JMX to check the parameters.

+10
source

Personally, I usually add both of the following two lines to my hibernate.cfg.xml

<property name="hibernate.c3p0.unreturnedConnectionTimeout">60</property> <property name="hibernate.c3p0.debugUnreturnedConnectionStackTraces">true</property> 

I believe the default timeout value is 0, and I'm not sure how this should work.

+3
source

Source: https://habr.com/ru/post/922065/


All Articles