Bug #76915 Misleading warning when per-query statement time is exceeded
Submitted: 3 May 2015 9:06 Modified: 7 May 2015 16:29
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.7.7-rc OS:Any
Assigned to: CPU Architecture:Any
Tags: usability

[3 May 2015 9:06] Daniël van Eeden
Description:
When a per-query max statement time is exceeded the following message is displayed:
ERROR 3024 (HY000): Query execution was interrupted, max_statement_time exceeded

This is not true, the per session max_statement_time might be 0 or higher than the per statement limit.

How to repeat:
mysql>SELECT * FROM t1;
+----+
| id |
+----+
|  1 |
|  2 |
|  3 |
+----+
3 rows in set (0.00 sec)

mysql>select id, sleep(id) from t1;
+----+-----------+
| id | sleep(id) |
+----+-----------+
|  1 |         0 |
|  2 |         0 |
|  3 |         0 |
+----+-----------+
3 rows in set (6.00 sec)

mysql>set max_statement_time=6001;
Query OK, 0 rows affected (0.00 sec)

mysql>select id, sleep(id) from t1;
+----+-----------+
| id | sleep(id) |
+----+-----------+
|  1 |         0 |
|  2 |         0 |
|  3 |         0 |
+----+-----------+
3 rows in set (6.00 sec)

mysql>select /*+ MAX_EXECUTION_TIME(5000) */ id, sleep(id) from t1;
ERROR 3024 (HY000): Query execution was interrupted, max_statement_time exceeded
mysql>set max_statement_time=5000;
Query OK, 0 rows affected (0.00 sec)

mysql>select /*+ MAX_EXECUTION_TIME(6001) */ id, sleep(id) from t1;
+----+-----------+
| id | sleep(id) |
+----+-----------+
|  1 |         0 |
|  2 |         0 |
|  3 |         0 |
+----+-----------+
3 rows in set (6.00 sec)

Suggested fix:
Change the message from:
ERROR 3024 (HY000): Query execution was interrupted, max_statement_time exceeded
To:
ERROR 3024 (HY000): Query execution was interrupted, max_statement_time or per statement time exceeded

Or create s different error message when the per statement limit is exceeded.
[4 May 2015 16:42] MySQL Verification Team
Hi Daniël,

What do you think about this message instead:

+  eng "Query execution was interrupted, maximum statement execution time exceeded"
[5 May 2015 6:55] Daniël van Eeden
@Shane That would be perfect.
[7 May 2015 16:29] Paul DuBois
Noted in 5.7.8, 5.8.0 changelogs.

The error message indicating that statement execution was interrupted
referred to the max_statement_time system variable, even if the
relevant timeout was a per-statement value. The error message is now
more generic.