[CONC-586] Connector returns out of sync errors / packets out of order Created: 2022-04-06 Updated: 2022-04-08 Resolved: 2022-04-07 |
|
| Status: | Closed |
| Project: | MariaDB Connector/C |
| Component/s: | API |
| Affects Version/s: | 3.1.16 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | David Carver | Assignee: | Georg Richter |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
macOS 10.15.7, Ubuntu 20.04 |
||
| Description |
|
The following PHP code code causes a packets out of order error
Error
The following code cause an out of sync error
Error
|
| Comments |
| Comment by David Carver [ 2022-04-06 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Here is another test program written in C so you don't have to dig through the PHP source
Outputs
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Georg Richter [ 2022-04-07 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It's an expected behaviour, also reproducable with mysqlnd. By default result sets from prepared statements are unbuffered, which means you need either to fetch entire result or to store them before executing another command. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by David Carver [ 2022-04-07 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Can you clarify on this please? I store the results from my stmt1, and then prepare and execute my stmt2. I do not store stmt2 results before fetching stmt1 results, but since I stored stmt1 results how is fetching the results executing another command? I'm not making anymore calls to the server by fetching my stored stmt1 results, correct? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by David Carver [ 2022-04-07 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
From looking at the source, fetching stored results changes the value of stmt->mysql->status? Why would fetching stored results change the status of the MySQL connection? What is the point of storing results if I can't execute other commands while the previous results are stored? It also seems wrong that I can in fact execute all the other commands I want, and even fetch stored results, but it's once the stored results reach EOF that the commands get out of sync. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Georg Richter [ 2022-04-08 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Please note that this is bug tracker, not a support forum. As I mentioned in my previous comment, the behavior is expected and reproducible with mysqlnd, so it's defenitly not a bug in MariaDB Connector/C. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by David Carver [ 2022-04-08 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
To be clear I'm not asking for support, simply clarification. The MySQL 5.7 and 8.0 connectors do not have this bug. The bug is "fetching stored results changes the existing MySQL state." After the stmt1 results are stored, stmt2 is prepared and executed. Iterating stmt1 results changes the state from MYSQL_STATUS_STMT_RESULT to MYSQL_STATUS_READY which is the bug, as iterating stored results should not change this. If you don't want to fix this that's one thing, but considering the API worked / works fine in MySQL 5.7 and 8.0, I would consider this a bug. |