druid版本1.1.1出现ERROR c.alibaba.druid.pool.DruidDataSource - discard connection

imzjd6km  于 4个月前  发布在  Druid
关注(0)|答案(4)|浏览(66)

使用druid版本1.1.1,闲置一段时间出现以下错误
ERROR c.alibaba.druid.pool.DruidDataSource - discard connection
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 63,213,665 milliseconds ago. The last packet sent successfully to the server was 63,213,666 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
请问是什么原因导致的,还望能协助解决一下

rkttyhzu

rkttyhzu1#

网络闪断后再请求出现过类似的问题,版本1.1.10,
2018-06-11 13:39:32.522 ERROR 17032 --- [http-nio-8080-exec-3] c.a.d.p.DruidPooledStatement :
CommunicationsException, druid version 1.1.10, jdbcUrl : jdbc:mysql://xxx.mysql.rds.aliyuncs.com:3306/xx?useSSL=false&allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai, testWhileIdle true, idle millis 48915, minIdle 10, poolingCount 8, timeBetweenEvictionRunsMillis 3600000, lastValidIdleMillis 48915, driver com.mysql.cj.jdbc.Driver, exceptionSorter com.alibaba.druid.pool.vendor.MySqlExceptionSorter
2018-06-11 13:39:32.522 ERROR 17032 --- [http-nio-8080-exec-3] c.a.d.p.DruidDataSource :
discard connection

6rqinv9w

6rqinv9w2#

我这里单机必现discard connection这个问题,重启应用、重启服务器都不行,咋整呢

1szpjjfi

1szpjjfi3#

我这里单机必现discard connection这个问题,重启应用、重启服务器都不行,咋整呢

实在不行就配置testOnBorrow=true吧,避免这种出错,另外可以使用SpringBoot官方默认的连接池HikariCP.

hpxqektj

hpxqektj4#

1.1.19遇到这个问题,记录下
com.mysql.cj.jdbc.exceptions.CommunicationsException: The last packet successfully received from the server was 63,284,512 milliseconds ago. The last packet sent successfully to the server was 63,284,512 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

相关问题