Mysql: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
2019-05-28 01:53:42.762 [message remind thread-24] ERROR druid.sql.Statement - {conn-10327, stmt-32027} execute error. SELECT 1 FROM DUAL
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 5,348,934 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.
at sun.reflect.GeneratedConstructorAccessor85.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3559)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3459)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3900)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2483)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2441)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1381)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeQuery(FilterChainImpl.java:2363)
at com.alibaba.druid.filter.FilterAdapter.statement_executeQuery(FilterAdapter.java:2481)
at com.alibaba.druid.filter.FilterEventAdapter.statement_executeQuery(FilterEventAdapter.java:302)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeQuery(FilterChainImpl.java:2360)
at com.alibaba.druid.filter.FilterAdapter.statement_executeQuery(FilterAdapter.java:2481)
at com.alibaba.druid.filter.FilterEventAdapter.statement_executeQuery(FilterEventAdapter.java:302)
at com.alibaba.druid.filter.FilterChainImpl.statement_executeQuery(FilterChainImpl.java:2360)
at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.executeQuery(StatementProxyImpl.java:211)
at com.alibaba.druid.pool.ValidConnectionCheckerAdapter.isValidConnection(ValidConnectionCheckerAdapter.java:44)
at com.alibaba.druid.pool.DruidAbstractDataSource.testConnectionInternal(DruidAbstractDataSource.java:1298)
at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1054)
at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4544)
at com.alibaba.druid.filter.logging.LogFilter.dataSource_getConnection(LogFilter.java:831)
at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4540)
at com.alibaba.druid.filter.stat.StatFilter.dataSource_getConnection(StatFilter.java:662)
at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4540)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:992)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:984)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:103)
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:246)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:461)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:277)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy119.insert(Unknown Source)
at com.lolaage.cmm.thread.YjInfoHandleThread$WorkThread.run(YjInfoHandleThread.java:72)
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3011)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3469)
... 37 common frames omitted
===> 客户端使用的连接已经关闭了。
1.检查是否有设置定期检查空闲连接
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
spring.datasource.timeBetweenEvictionRunsMillis=60000
spring.datasource.validationQuery=SELECT 1 FROM DUAL
spring.datasource.testWhileIdle=true
spring.datasource.testOnBorrow=false
spring.datasource.testOnReturn=false
2.检查数据库中的wait_timeout
show global variables like 'wait_timeout';
show global variables like 'interactive_timeout';
如果数据库中wait_timeout小于客户端代码中maxEvictableIdleTimeMillis的值,也会导致客户端使用时,出现已经关闭的连接。
Mysql: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.的更多相关文章
- tomcat链接mysql时超时报错java.io.EOFException: Can not read response from server. Expected to read 4 bytes,
需要在配置文件里加上下面就ok了 <property name=”minEvictableIdleTimeMillis” value=”1800000″ /> <property n ...
- jeecms运行出现 Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.解决
在/WEB-INF/config/application-context.xml中添加红色字体内容: <bean id="dataSource" class="co ...
- Request 、Response 与Server的使用
纯属记录总结,以下图片都是来自 ASP.NET笔记之 Request .Response 与Server的使用 Request Response Server 关于Server.MapPath 方法看 ...
- 解决:Could not parse response code.Server Reply: SSH-2.0-OpenSSH_5.3
[摘要:办理:org.apache.commons.net.MalformedServerReplyException: Could not parse response code.Server Re ...
- Response.Redirect("");Server.Transfer("")跳转页面的区别
Response.Redirect("") Server.Transfer("") 转向其他站点 能 不能(只能站内转向) 是否可带QueryString参 ...
- ASP.NET中的Request、Response、Server对象
Request对象 Response.Write(Request.ApplicationPath) //应用根路径 Request.AppRelativeCurrentExecutionFilePat ...
- MySQL社区版升级到Percona Server
出于磁盘空间的考虑,在调研以后把磁盘空间紧张的库的引擎改为tokudb,(在改为tokudb引擎之前是innodb引擎,已经压缩过,但空间还是紧张)关于tokudb的优势各位自行查阅相关资料.要启用t ...
- [Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.
待解决 [Fiddler] ReadResponse() failed: The server did not return a complete response for this request. ...
- ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0
最近遇到一个MySQL连接的问题,远程连接MySQL时遇到"ERROR 2013 (HY000): Lost connection to MySQL server at 'reading a ...
随机推荐
- 代码 | 自适应大邻域搜索系列之(5) - ALNS_Iteration_Status和ALNS_Parameters的代码解析
前言 上一篇推文说了,后面的代码难度直线下降,各位小伙伴可以放去n的100次方心了.今天讲讲一些细枝末节,就是前面一直有提到的参数和一些状态的记录代码.这个简单啦,小编也不作过多解释了.大家直接看代码 ...
- TensorFlow(十六):TensorFlow GPU准备
一:安装cuda 下载地址 二:安装cuDNN 三:安装GPU版TensorFlow 注意:gpu版的TensorFlow打开tensorboard要使用:tensorboard --logdir C ...
- Word 有哪些神奇的功能?
作者:秦阳链接:https://www.zhihu.com/question/27035859/answer/621742048来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明 ...
- yii中异步验证和自定义方法验证
一.异步验证,一般使用ajax验证唯一性较多 1.model开启验证[['mobile_id','ip'], 'unique','message'=>Yii::t('app','E10010') ...
- python map() 的使用方法
>>>def square(x) : # 计算平方数 ... ... >>> map(square, [,,,,]) # 计算列表各个元素的平方 [, , , , ...
- Linux堆的一些基础知识
目录 堆的概述 什么是堆 堆的基本操作 堆操作背后的系统调用 堆的相关数据结构 微观结构 malloc_chuck chunk相关宏 bin 宏观结构 arena heap_info malloc_s ...
- Mininet系列实验(三):Mininet命令延伸实验扩展
1 实验目的 熟悉Mininet自定义拓扑三种实现方式:命令行创建.Python脚本编写.交互式界面创建. 2 实验原理 Mininet 是一个轻量级软件定义网络和测试平台:它采用轻量级的虚拟化技术使 ...
- 使用 Fiddler 抓取iPhone 的 HTTPS 请求
Fiddler 是著名的 HTTP(S) 抓包工具,功能十分强悍.Fiddler 采用代理的方式进行抓包,所以使用范围就非常广泛,不仅可以在 PC 端使用,更可以在移动设备上使用. 要在 iPhone ...
- HearthBuddy模拟对手的回合
start calculations, current time: 10:29:48 V2019.09.01.002 Rush 10000 face 27 berserk:1 ets 200 secr ...
- OpenJudge计算概论-年龄与疾病
/*========================================================== 年龄与疾病 总时间限制: 1000ms 内存限制: 65536kB 描述 某医 ...