暂无图片
暂无图片
3
暂无图片
暂无图片
1
暂无图片

mysql错误日志Communications link failure Last packet sent to the server was 1 ms ago.

原创 金同学 2023-05-18
522

错误信息

Request processing failed; nested exception is org.springframework.transaction. CannotCreate TransactionException: Could not open JDBC Connection for transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure Last packet sent to the server was 1 ms ago.


原因

线程池超时时间大于数据库超时时间


解决方法

1、减小线程池超时时间,如下示例druid线程池修改以下值。

testWhileIdle: true
timeBetweenEvictionRunsMillis=60000
minEvictableIdleTimeMillis=160000
maxEvictableIdleTimeMillis=230000
复制

2、增大数据库超时时间

set global wait_timeout=28800;
复制

在生产环境优先调整线程池超时时间,因为调大数据库超时时间会增加数据库短连接风暴的风险。

最后修改时间:2023-05-18 18:53:20
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
1人已赞赏
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论

袁妮
暂无图片
4月前
评论
暂无图片 0
学习了
4月前
暂无图片 点赞
评论