问题
I've used jdbcpool 7.0.47 on grails app with version 2.2.4. When i checked the threaddump it shows that lots of "MySQL Statement Cancellation Timer" are in waiting state. I've also tried moving the jdbc connector to tomcat/lib but it start to give some date issues with mysql. So any other way to kill those threads
回答1:
Ok evaluating all the params of connection pooling it seems validationQueryTimeOut was causing all this issue. After removing that param everything is normal. Now my working connection pooling properties are like this
properties {
initialSize=5
maxActive=50
minIdle=5
maxIdle=25
maxWait = 10000
maxAge = 10 * 60000
timeBetweenEvictionRunsMillis=5000
minEvictableIdleTimeMillis=60000
validationQuery="SELECT 1"
validationInterval=15000
testWhileIdle=true
testOnBorrow=true
testOnReturn=false
jdbcInterceptors = "ConnectionState"
defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
}
回答2:
My program doesn't use pools and I've also experienced this issue.
My fix was to update MySQL connector from 5.1.6 to 5.1.35 and close SessionFactory at the end of the program, which I wasn't doing.
来源:https://stackoverflow.com/questions/25264535/mysql-statement-cancellation-timer-in-waiting-state-in-grails-2-2-4-with-jdbc-po