mysql 数据库连接 aborted connection问题处理

1、问题现象:

应用连接mysql数据库出现超时情况,错误信息如下所示:

2022-12-15 14:13:13.831 ERROR 1548945 --- [ XNIO-1 task-12] c.s.v.c.f.s.h.GlobalBizExceptionHandler  : 全局异常信息 ex=nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms.
### The error may exist in cn/seres/vst/testCase/mapper/TestProgramMapper.java (best guess)
### The error may involve cn.seres.vst.testCase.mapper.TestProgramMapper.selectList
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms.
2、问题分析:

分析mysql数据库日志,发现存在连接超时和通讯包错误的信息

造成mysql出现aborted_connects可能原因是:

a、程序退出前,客户机程序没有调用mysql_close()

b、客户端睡眠时间超过了wait_timeout或interactive_timeout参数的秒数;

c、客户端程序在数据传输过程中终止。

按照这个思路,马上排查程序配置,发现程序使用的连接池设置的超时时间大于mysql的超时时间

3、解决方案

修改mysql数据库wait_timeout和interactive_timeout参数,由默认28800修改为程序连接池设置的超时时间600000,问题现象得以解决。


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部