| Bug #55020 | got an error reading communication packets & CR_COMMANDS_OUT_OF_SYNC | ||
|---|---|---|---|
| Submitted: | 6 Jul 2010 8:38 | Modified: | 18 May 2011 15:26 |
| Reporter: | [ name withheld ] | Email Updates: | |
| Status: | No Feedback | Impact on me: | |
| Category: | MySQL Server: C API (client library) | Severity: | S1 (Critical) |
| Version: | 5.1.45-47 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[6 Jul 2010 9:28]
Sveta Smirnova
Thank you for the report. Have you specified CLIENT_MULTI_STATEMENTS flag for mysql_real_connect?
[6 Aug 2010 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[18 May 2011 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".

Description: "select *" on a connection return CR_COMMANDS_OUT_OF_SYNC after a "Select ... IN ..." query! At the same time, the mysql log shows "got an error reading communication packets". Now I have to work around it using an additional mysql_next_result call which always return 1. (when debugging into the libmysql code, it means the "error reading communication packet".) How to repeat: CREATE TABLE `user` ( `uin` BIGINT UNSIGNED NOT NULL auto_increment, `id` char(64) NOT NULL DEFAULT '', PRIMARY KEY (`uin`), KEY `vip` (`vip`), UNIQUE `id` (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; code as: //init to get a handle MYSQL* hMysql //query 1, it's ok! (but the mysql connection already has problem!) if(mysql_real_query(hMysql, "SELECT uin,id FROM user WHERE uin IN (1,2,3,4) LIMIT 4;")==0) { MYSQL_RES* Res = mysql_store_result(hMysql); if(Res) { //fetch the rows! mysql_free_result(Res); } } //!!!query 2 will always failed with CR_COMMANDS_OUT_OF_SYNC!!! mysql_real_query(hMysql, "SELECT uin,id FROM user WHERE uin = 5 LIMIT 1;"); Suggested fix: so I have to do some mysql_next_result after "SELECT ... IN", code as: if(mysql_real_query(hMysql, "SELECT uin,id FROM user WHERE uin IN (1,2,3,4) LIMIT 4;")==0) { MYSQL_RES* Res = mysql_store_result(hMysql); if(Res) { //fetch the rows! mysql_free_result(Res); //********* additional call to fix the connection! ************* while(true) { if(mysql_next_result(hMysql) == 0) continue; //In fact, this call ALWAYS return 1! else break; } } } //then we can call any SELECT successfully on hMysql!