MySQL Other--ER_QUERY_INTERRUPTED(1317)

场景描述

应用程序报错:

### Error updating database.  Cause: com.mysql.jdbc.exceptions.MySQLStatementCancelledException: Statement cancelled due to client request
### The error may involve com.qunar.flight.tts.rmgmt.dao.alternative.RiskMsgDao.unfreezeAfterFlyRiskMsgByDomainTkt-Inline
### The error occurred while setting parameters
### Cause: com.mysql.jdbc.exceptions.MySQLStatementCancelledException: Statement cancelled due to client request
; uncategorized SQLException; SQL state [null]; error code [0]; Statement cancelled due to client request; 
nested exceptionis com.mysql.jdbc.exceptions.MySQLStatementCancelledException: Statement cancelled due to client request
        ...
Caused by: com.mysql.jdbc.exceptions.MySQLStatementCancelledException: Statement cancelled due to client request
        ....

查看慢日志:

# Time: 2023-03-14T17:45:36.824642+08:00
# User@Host: xxxx_rw[xxxx_rw] @  [10.xx.xx.xx]  Id: 857038238
# Schema: xxx_dba Last_errno: 1317  Killed: 0
# Query_time: 27.661371  Lock_time: 0.000062  Rows_sent: 0  Rows_examined: 837113  Rows_affected: 0
# Bytes_sent: 44
SET timestamp=1678787136;
update xxx
set xxx=xxx
where xxx < DATE_SUB(CURRENT_TIMESTAMP(),INTERVAL 1 DAY);

问题原因

应用程序部署有守护者程序,执行超过N秒后会自动向MySQL服务发送KILL请求,触发请求终止。

排查重点

  • 根据"Statement cancelled due to client request"错误来查找。
  • 根据慢日志中Last_errno:1317错误来排查。

其他扩展

  • 查询执行时间超过应用客户端配置的超时设置时,会报错:Statement cancelled due to timeout or client request
posted @ 2023-03-14 18:24  TeyGao  阅读(269)  评论(0编辑  收藏  举报