Bug #6804 KILL QUERY fails (packets out of order)
Submitted: 24 Nov 2004 15:58 Modified: 25 Feb 2005 20:02
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0 OS:Linux (linux)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[24 Nov 2004 15:58] Guilhem Bichot
Description:
MASTER> select get_lock("a", 10);
+-------------------+
| get_lock("a", 10) |
+-------------------+
|                 1 |
+-------------------+
1 row in set (0.00 sec)

then in another connection (with assumed thread id 3) do
select get_lock("a", 10);
it will hang. Then in first connection do

MASTER> kill query 3;
Query OK, 0 rows affected (0.00 sec)

Then in connection 3 the select returns like this:
MASTER> select get_lock("a", 10);
+-------------------+
| get_lock("a", 10) |
+-------------------+
|              NULL |
+-------------------+
1 row in set (1.96 sec)

MASTER> show tables;
Packets out of order (Found: 6, expected 1)
ERROR 2013 (HY000): Lost connection to MySQL server during query

How to repeat:
see description.

Suggested fix:
I am assigning this one to me as it came while testing graceful shutdown I'm working on and both topics are closely related.
[24 Nov 2004 23:31] Guilhem Bichot
There is the larger problem in a race condition (where query starts, runs, finishes, and notices the kill just before leaving dispatch_command()), then again ok and error packets are sent.
[20 Jan 2005 8:57] Oleksandr Byelkin
ChangeSet
  1.1819 05/01/20 10:41:37 bell@sanja.is.com.ua +7 -0
  Fixed problem of sending ERROR to client after OK or EOF (BUG#6804)
[24 Feb 2005 2:17] Oleksandr Byelkin
Thank you for bugreport!
Bugfix is pushed into 5.0.3 source repository.
[25 Feb 2005 20:02] Paul DuBois
Noted in 5.0.3 changelog.