mysql数据库异常:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 59,029 milliseconds ago. The last packet sent successfully to the server was 1 milliseconds ago.
数据源配置:
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/new_schema?characterEncoding=utf-8" />
<property name="user" value="root" />
<property name="password" value="root" />
<property name="minPoolSize" value="2" />
<property name="maxPoolSize" value="5" />
<property name="idleConnectionTestPeriod" value="60" />
<property name="acquireIncrement" value="3" />
<property name="maxStatements" value="0" />
<property name="maxStatementsPerConnection" value="5" />
<property name="preferredTestQuery" value="SELECT 1" />
<property name="debugUnreturnedConnectionStackTraces" value="true" />
<property name="numHelperThreads" value="5" />
<property name="maxIdleTime" value="200"/>
<property name="maxIdleTimeExcessConnections" value="60" />
</bean>
错误原因:
使用了HAProxy + cobar + mysql的架构,HAProxy中的timeout设置为50秒导致了上面的错误。
----------------------分割线----------------------------
还有网友分享了其他原因:
maxIdleTimeExcessConnections的时间小于maxIdleTime导致的。
不建议使用maxIdleTimeExcessConnections。
如果要使用,应该和maxIdleTime一样。
查询会话变量:
mysql> show session variables like '%wait%';
+--------------------------+----------+
| Variable_name | Value |
+--------------------------+----------+
| innodb_lock_wait_timeout | 50 |
| innodb_spin_wait_delay | 6 |
| lock_wait_timeout | 31536000 |
| wait_timeout | 28800 |
+--------------------------+----------+
4 rows in set (0.00 sec)
查询全局变量:
mysql> show global variables like '%wait%';
+--------------------------+----------+
| Variable_name | Value |
+--------------------------+----------+
| innodb_lock_wait_timeout | 50 |
| innodb_spin_wait_delay | 6 |
| lock_wait_timeout | 31536000 |
| wait_timeout | 30 |
+--------------------------+----------+
4 rows in set (0.00 sec)
http://forums.pentaho.com/showthread.php?140518-MySql-Communications-link-failure-SOLVED
http://wiki.pentaho.com/display/EAI/MySQL
The MySQL server parameter "net_write_timeout" defaults to 60 seconds.
I found that by increasing this to a larger value, the exception goes away.
Then we do not have to turn off the result set cursor and we don't need
to read the entire result set into memory by turning off result set streaming (cursor emulation)
This parameter is set in my.ini. I set it to 1800, but probably a
smaller value would suffice.
http://cloudbbs.org/forum.php?mod=viewthread&tid=11629
MySQL连接30秒不使用会自动丢失,你可以参考以下配置
<property name="maxPoolSize" value="12" />
<property name="minPoolSize" value="0" />
<property name="maxStatements" value="100" />
<property name="initialPoolSize" value="3" />
<property name="maxIdleTime" value="10"/>
<property name="idleConnectionTestPeriod" value="10" />
<property name="testConnectionOnCheckin" value="true" />
<property name="testConnectionOnCheckout" value="false" />
<property name="preferredTestQuery" value="SELECT 1 FROM DUAL" />
http://serverfault.com/questions/439329/haproxy-client-timeouts-when-connecting-from-jdbc-pool
Haproxy 超时时间设置
分享到:
相关推荐
Cause com.mysql.jdbc.exceptions.jdbc4.CommunicationsException The last packet successfully received from the server was 47,795,922 milliseconds ago. The last packet sent successfully to the server was...
1、写在开头 标题之前我想说一下Linux的mysql真的实在是太坑了。太坑了。总是会出现这样那样的你想不到的问题。崩溃了。首先来罗列一下我遇到过的...Cause:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorExcepti
博文链接:https://zyx19920203.iteye.com/blog/2301226
com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error:GlobalConfigUtils setMetaData Fail !
c-jdbc数据库集群中间件详细配置方案(mysql),可以同步使用多个数据库数据交换。
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user ''@'localhost' to database 'hibernate' at sun.reflect.NativeConstructorAccessorImpl.new
1、Caused by: com.MySQL.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 56,201,339 milliseconds ago. The last packet sent successfully to the...
MyEclipse8.x 汉化 包括汉化语言包和汉化方法
Caused by: org.apache.ibatis.exceptions.PersistenceException: Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested ...
解决:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after statement closed.
可以通过异常:Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Acc
4)....Added "--el_injectjcl", "--el_createjcl", and "--el_createdbg" command-line options for ecc32/emake to inject JEDI/JCL debug info, create .jdbg file, and create .dbg file (Microsoft debug format...
问题 Table ‘zup.Domain_System’ doesn’t exist ...### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'zup.Domain_System' doesn't exist ; bad SQL grammar []; nested
可用包+源码;最新版nacos-server-1.2.0.tar.gz 支持mysql 8.0
• 并发事务,间隙锁可能互斥 (1)A删除不存在的记录,获取共享间隙锁; (2)B插入,必须获得排他间隙锁,故互斥; • 并发插入相同记录,可能死锁(某一个回滚) • 并发插入,可能出现间隙锁死锁(难排查) ...
今天用execjs调用JS时,发现报错execjs._exceptions.ProgramError: ReferenceError: document is not defined 如图: 错误类型:文档对象未定义,解决方法,定义对象即可,习惯性定义变量嘛 var document ;? ...
根据菜鸟教程Django教程学习,运行”python manage.py migrate” 报错,出现 django.db.utils.OperationalError: (1045, “Access denied for user ‘账号’@’localhost’ ... 'ENGINE': 'django.db.backends.mysql',
Mybatis报错: org.apache.ibatis.exceptions.PersistenceException解决办法 一、问题描述 写好配置文件用JUnit进行测试,一运行就报错: org.apache.ibatis.exceptions.PersistenceException: ### Error querying ...
郁闷啊,有时候不得不承认,无论是什么事,曾经是好的,到后边未必还是好的,不要拿曾经的种种来判断今天的结果, 前景:之前本地用jeecg(1.7版本)设计流程、发布流程、修改流程,所有的操作都是项目有汉字启动的,...