Bug #1484 Packets out of order after SET sort_buffer_size = (subquery)
Submitted: 4 Oct 2003 18:13 Modified: 24 Oct 2003 11:19
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.1 OS:Linux (SuSE 8.2)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[4 Oct 2003 18:13] Peter Gulutzan
Description:
I can get "Packets out of order" by saying SET sort_buffer_size = (subquery). 
The subquery returns more than one row. 

How to repeat:
mysql> use db41; 
 
Database changed 
mysql> create table t1 (s1 int); 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> insert into t1 values (1); 
Query OK, 1 row affected (0.00 sec) 
 
mysql> insert into t1 values (2); 
Query OK, 1 row affected (0.00 sec) 
 
mysql> set sort_buffer_size = (select s1 from t1); 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> select * from t1; 
Packets out of order (Found: 2, expected 1) 
ERROR 2013 (HY000): Lost connection to MySQL server during query 
 

Suggested fix:
Disallow SET assignments where source = (subquery that returns more than one row), 
just as you disallow UPDATE ... SET = (subquery that returns more than one row).
[5 Oct 2003 8:41] Peter Gulutzan
This looks like it is possibly related: if I have a subquery which returns two rows, and I use 
it in a DO statement, then the next DO statement will cause "Packets out of order". For 
example: 
 
mysql> create table t11 (s1 int); 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> insert into t11 values (1); 
Query OK, 1 row affected (0.00 sec) 
 
mysql> insert into t11 values (1); 
Query OK, 1 row affected (0.00 sec) 
 
mysql> do (select * from t11); 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> do 9; 
Packets out of order (Found: 2, expected 1) 
ERROR 2013 (HY000): Lost connection to MySQL server during query 
mysql>
[8 Oct 2003 1:25] Oleksandr Byelkin
ChangeSet 
  1.1579 03/10/08 11:19:09 bell@laptop.sanja.is.com.ua +4 -0 
  fixed error handling in SET and DO operators (BUG#1484)
[24 Oct 2003 11:19] Oleksandr Byelkin
Thank you for bugreport. 
 
Fix for this bug is pushed in source repoisitory og mysql 4.1 and will be 
present in next release of version 4.1 server