记一次Could-not-retrieve-transation-readonly-status-server异常
简述:技术,spring+mysql....新项目上线碰到一个问题,具体现象为执行一个方法时报异常,异常信息如下: 2019-08-20 09:46:08.917[ERROR][Log4jFilter.java:152][DubboServerHandler-192.168.12.156:28104-thread-207] {conn-10670, pstmt-21062} execute error. delete from Dpgd where shco = ?java.sql.SQLException: Could not retrieve transation read-only status server .... at java.lang.Thread.run(Thread.java:745)Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failureThe last packet successfully received from the server was 7,603 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. ... at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1038)最开始只看到Could not retrieve transation read-only status server没看到下面的Communications link failure,以为是在代码中手动设置事务状态为只读或者事务回滚,后来查代码也没发现。当看到Communications link failure意识到连接异常,但与当前方法连接同一个库的其他方法可以执行成功,所以数据库服务也是正常的。 最终发现原因:排查的方法中有其他操作发送http请求,稍微有点耗时,但整个方法一分钟之类肯定能处理完。 ...