MySQL Statement Cancellation Timer in waiting state in grails 2.2.4 with jdbc pool

3.3k Views Asked by At

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

2

There are 2 best solutions below

0
On BEST ANSWER

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
}
0
On

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.