记录使用Quartz Cluster出现异常已经解决方案

问题描述

....省略部分错误
The last packet successfully received from the server was 3,689,831 milliseconds ago.
The last packet sent successfully to the server was 3,689,833 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.; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: The last packet successfully received from the server was 3,689,831 milliseconds ago. ....省略部分错误

问题分析

错误日志告诉了我们,从服务器成功接收到最后一个数据包是3689831毫秒前,最后一个成功发送到服务器的数据包是3689833毫秒前的数据包,超过了mysql配置的wait_timeout配置的时间。告诉我们需要增加客户端超时的服务器配置,或者使用autoReconnect=true配置数据库连接来避免这个问题,

解决方案

1、修改mysql中wait_timeout配置

show global variables like '%time%' ;
SET GLOBAL wait_timeout = 28800;(秒)

2、数据库链接增加autoReconnect=true和autoReconnectForPools=true
autoReconnect:会向客户端抛出一个SQLException异常,但是会尝试重新建立连接
autoReconnectForPools:在每次执行SQL之前都会尝试ping服务器

autoReconnect在官方文档中不推荐使用,如果启用这个属性,MySQL驱动将会对当前事务的已过期或者被废弃的链接发出查询请求抛出异常,并会在发起下一次请求之前尝试重新建立链接,只有在程序无法正确处理死链或者已被回收的链接所导致的SQLException异常时使用,建议修改MySQL的wait_timeout参数,使其大于8个小时

参考资料:MySQL 文档

Quartz Cluster出现异常Couldn‘t rollback jdbc connection. Communications link failure during rollback().相关推荐

  1. MySQL连接问题: MySQLNonTransientConnectionException:Communications link failure during rollback()

    昨天线上出现了这样的一个问题:MySQLNonTransientConnectionException:Communications link failure during rollback() 初步 ...

  2. quartz异常:Couldn't rollback jdbc connection

    为什么80%的码农都做不了架构师?>>>    最近工作发现,有个项目偶尔会报Couldn't rollback jdbc connection. No operations all ...

  3. Druid 连接池 报错 com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

    场景赘述 早晨查看项目前一天的实际运行日志,发现了 一个Springboot项目中的druid 连接池和 mysql 产生了异常信息,重连暂并未对系统产生影响 下面是具体报错信息: com.mysql ...

  4. 连接mysql异常Communications link failure

    连接mysql 数据库的时候出现这个异常Communications link failure,原因:如果在wait_timeout秒期间内,数据库连接(java.sql.Connection)一直处 ...

  5. Mysql异常之Communications link failure

    前天线上出现数据数据抖动,收到大量异常告警,都要疯了,数据库出现大量异常,肯定第一件事就是看下数据库监控数据,发现有一个从分片执行时间有一个50多秒的操作,这里肯定有问题了,第一时间找了dba,经过排 ...

  6. com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

    com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure 数据库jdbc连接异常,数据库连接异 ...

  7. com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 数据库报错

    -- 查询mysql 数据库链接空闲时间持有最大空闲时间,单位为秒 SHOW VARIABLES WHERE VAriable_name = 'interactive_timeout'; -- 会出现 ...

  8. com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

    昨天数据库做了一些改动,早上再打开的项目的时候就出现了这样的问题 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communicat ...

  9. Underlying cause: com.mysql.cj.jdbc.exceptions.CommunicationsException : Communications link failure

    Hive试图schematool -dbType mysql -initSchema时候报错如下: Metastore connection URL:     jdbc:mysql://Desktop ...

最新文章

  1. linux动态链接库---一篇讲尽
  2. java 遍历对象_java中some(),every()循环遍历,Object.getOwnPropertyNames()遍历对象的属性...
  3. django2.0.6 连接使用redis集群
  4. LibreOj 6279数列分块入门 3 练习了一下set
  5. 你所不知道的端口号知识!
  6. python的发展趋势图_用Python绘制趋势图
  7. 4g网络切换软件_5G 网络NSA与SA模式 互操作策略研究
  8. poj 2976 Dropping tests 01分数规划
  9. Nginx源码阅读 ---- 模块的初始化过程,工作进程中初始化事件模块
  10. java this和super_Java中超详细this与super的概念和用法_Java_软件编程
  11. 使用C++模板判断两个类型是否一样
  12. ADSL密码查看器绿色版
  13. 深度装机大师一键重装_深度装机大师一键重装软件
  14. C#登录语音提醒操作
  15. 中公教育python教师_中公教育的教师水平怎么样?
  16. 【强化学习】优势演员-评论员算法(Advantage Actor-Critic , A2C)求解倒立摆问题 + Pytorch代码实战
  17. 【快速幂入门】自由弹簧
  18. JQ对复选框全选、获取复选框的值、回选
  19. 2022年,我加入了微软MVP大家庭
  20. drozer安装与使用

热门文章

  1. 计算机组成运算器原理实验报告,《计算机组成原理》运算器实验报告
  2. [转]深度学习及并行化实现概述
  3. python怎么设置随机数种子_PyTorch设置随机数种子使结果可复现
  4. Windows认证机制之Kerberos协议
  5. OpenMPI的安装与运行分布式项目
  6. mysql一主两从读写分离搭建
  7. 涉密计算机存储数据恢复,涉密集成数据恢复咨询
  8. 门面模式Facade
  9. android 2.3源码 百度网盘,Android 2.3.5源代码 更新至android 4.4,可以下载,度娘网盘...
  10. java 自學_JAVA自學之路 ——尚學堂科技馬士兵