记录使用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. mysql 常用操作
  2. 高效率开发必备!!!!
  3. 2021暑假实习-SSM超市积分管理系统-day04笔记
  4. Drools的HelloWord例子
  5. C++ 通讯录管理系统实验报告
  6. 北京 | 蚂蚁集团共享智能团队招聘研究实习生
  7. 拳王虚拟项目公社:微信朋友圈卖虚拟资源教程怎么做,月入过万发方法
  8. 自动化测试学习之路--json、dom编程
  9. “我辞退了一位学位学历造假的程序员“
  10. CentOS通过 liveCD 进入救援模式-重装 grub 修复损坏的
  11. Spark 基础——RDD 算子
  12. 关于MDI窗体的那些问题
  13. 4. 使用Keras-神经网络来进行MNIST手写数字分类
  14. simulink中积分环节、惯性环节、比例环节
  15. Python实现双线性插值、最近邻插值、三次内插法
  16. 矩阵快速幂(推导+模板+例题详解)
  17. 数码相框(十六、LCD显示JPG格式图片)
  18. 随笔2022.12.6
  19. NOIP2015总结
  20. 古琴销售怎么做阳php学,古琴斫琴要领

热门文章

  1. android oppo定位不到,OPPO新一代安卓旗舰解密:至少三款型号,定位配置完全不同...
  2. 记录--uniapp 应用APP跳转微信小程序
  3. CES 软件的新平台与新机遇
  4. scrapy 迭代爬取时,报错 Filtered offsite request
  5. python中 Int8 Int16 Int32 Int64 float uint8
  6. 2021年高压电工最新解析及高压电工模拟考试题库
  7. java中getfield_Java Class getField()用法及代碼示例
  8. 谷粒商城之分布式基础(二)
  9. android wifi热点广播,在Android wifi热点获取wifi广播地址
  10. Linux 5.17将引入新驱动程序来修复x86平板电脑问题