alibaba / druid

阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
https://github.com/alibaba/druid/wiki
Apache License 2.0
27.9k stars 8.57k forks source link

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

Open jungleming opened 6 years ago

jungleming commented 6 years ago

使用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. 请问是什么原因导致的,还望能协助解决一下

cloudcard commented 6 years ago

网络闪断后再请求出现过类似的问题,版本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

taotao0325 commented 4 years ago

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

yuxiao97 commented 4 years ago

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

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

sxyseo commented 2 years ago

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.