连接关闭错误后不允许操作的原因?
cause of no operations allowed after connection closed error?
我正在使用 grails 3.3.9 构建示例 hello 应用程序。部署应用程序后,它工作正常。当我在大约一天后检查时,该应用程序已经崩溃。检查日志,我看到一个错误 "no operations allowed after connection closed."。看起来 mysql 数据库连接在某个时候断开了。
这是我在 application.yml
中使用的数据库配置
我很感激任何关于为什么与数据库的连接在一段时间后自动关闭的见解。我该如何预防?感谢您的反馈。
我为生产添加了以下内容,到目前为止错误没有再次出现。
properties:
jmxEnabled: true
initialSize: 5
maxActive: 50
minIdle: 5
maxIdle: 25
maxWait: 10000
maxAge: 600000
timeBetweenEvictionRunsMillis: 5000
minEvictableIdleTimeMillis: 60000
validationQuery: SELECT 1
validationQueryTimeout: 3
validationInterval: 15000
testOnBorrow: true
testWhileIdle: true
testOnReturn: false
jdbcInterceptors: ConnectionState
defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED
我正在使用 grails 3.3.9 构建示例 hello 应用程序。部署应用程序后,它工作正常。当我在大约一天后检查时,该应用程序已经崩溃。检查日志,我看到一个错误 "no operations allowed after connection closed."。看起来 mysql 数据库连接在某个时候断开了。
这是我在 application.yml
中使用的数据库配置我很感激任何关于为什么与数据库的连接在一段时间后自动关闭的见解。我该如何预防?感谢您的反馈。
我为生产添加了以下内容,到目前为止错误没有再次出现。
properties:
jmxEnabled: true
initialSize: 5
maxActive: 50
minIdle: 5
maxIdle: 25
maxWait: 10000
maxAge: 600000
timeBetweenEvictionRunsMillis: 5000
minEvictableIdleTimeMillis: 60000
validationQuery: SELECT 1
validationQueryTimeout: 3
validationInterval: 15000
testOnBorrow: true
testWhileIdle: true
testOnReturn: false
jdbcInterceptors: ConnectionState
defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED