I use Grails 2.5.3 and Tomcat7, and after 8 hours of application deployment, our logs begin to explode with connection problems already closed. A good guess is that MySql kills the connection after a default timeout of 8 hours.
According to the docs, my pool seems to be configured correctly to keep open connections open, but it doesn't seem to be that way.
What could be wrong in setting up a connection pool?
dataSource {
pooled = true
url = 'jdbc:mysql://******.**********.us-east-1.rds.amazonaws.com/*****'
driverClassName = 'com.mysql.jdbc.Driver'
username = '********'
password = '******************'
dialect = org.hibernate.dialect.MySQL5InnoDBDialect
loggingSql = false
properties {
jmxEnabled = true
initialSize = 5
timeBetweenEvictionRunsMillis = 10000
minEvictableIdleTimeMillis = 60000
validationQuery = "SELECT 1"
initSQL = "SELECT 1"
validationQueryTimeout = 10
testOnBorrow = true
testWhileIdle = true
testOnReturn = true
testOnConnect = true
removeAbandonedTimeout = 300
maxActive=100
maxIdle=10
minIdle=1
maxWait=30000
maxAge=900000
removeAbandoned="true"
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.StatementCache;"
}
}
hibernate {
cache.use_second_level_cache=true
cache.use_query_cache=true
cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory'
}
Also , I confirmed that the dataSource is an instance ( org.apache.tomcat.jdbc.pool.DataSource) at runtime
1 ( )
, , , ! http , factory, , http - . http 8 , , . , .
2 ()
, , . removeAbedoned removeAbandonedTimeout . , , , , . , . 4 - .