Background:
We have observed the warning in the log file. The java application is using Spring+Hibernate+c3p0 combination for database connectivity.
Error Text:
WARN v2.async.ThreadPoolAsynchronousRunner:608 - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@3dcfc162 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Possible Solutions:
We have observed the warning in the log file. The java application is using Spring+Hibernate+c3p0 combination for database connectivity.
Error Text:
WARN v2.async.ThreadPoolAsynchronousRunner:608 - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@3dcfc162 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Possible Solutions:
- Increase Statement pool size using "maxStatements" (JDBC standard) or set to zero. (see Note-01)
- Increase statement pool size using "maxStatementsPerConnection" (users find this more intuitive) or set to zero (see Note-01)
- Set "statementCacheNumDeferredCloseThreads". this parameter should almost always be set to 1. (see Note-02)
Solution worked for me:
I used statementCacheNumDeferredCloseThreads=1 and maxStatementsPerConnection=30
Notes:
- Statement caching will be disabled if both "maxStatements" and "maxStatementsPerConnection" are set to zero
- Basically, if you need more than one Thread dedicated solely to destroying cached Statements, you should set maxStatements and/or maxStatementsPerConnection so that you don't churn through Statements so quickly.
References:
1. http://www.mchange.com/projects/c3p0/