Re: com.mysql.jdbc.exceptions.MySQLQueryInterruptedException: Query execution was interrupted
Posted by: Todd Farmer
Date: November 05, 2013 04:25PM

Hi Steve,

That error message is commonly associated with a query being explicitly killed by another thread. Here's an example from the mysql command line client, when KILL QUERY is issued in another connection, targeting this one:

mysql> SELECT SLEEP(100), a FROM test.t;
ERROR 1317 (70100): Query execution was interrupted

So, the question is: What/who is killing your queries?

There's a few ways to get this information. First, check global status counter for Com_kill:

mysql> SHOW GLOBAL STATUS LIKE '%kill%';
| Variable_name | Value |
| Com_kill | 3 |
1 row in set (0.00 sec)

Assuming you see non-zero values there, you know that somebody has issued KILL commands, but not much more than that. You can enable the general query log (or MySQL Enterprise Audit Log plugin) to catch who's issuing it. Or, if you are using MySQL 5.6, you can leverage PERFORMANCE_SCHEMA:

A common cause for JDBC users is that somebody, somewhere, has called Statement.setQueryTimeout():

This causes Connector/Java to spawn up a new connection when the threshold is reached, issue KILL QUERY, and disconnect. This should be pretty easy to identify in general query or audit log output - the boilerplate connection statements executed by Connector/Java are the only other things besides the KILL QUERY done by that connection.

Hope that helps,

Todd Farmer
MySQL @ Oracle

Options: ReplyQuote

Written By
Re: com.mysql.jdbc.exceptions.MySQLQueryInterruptedException: Query execution was interrupted
November 05, 2013 04:25PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.