Bug #103264 Regression in v8.0.20 breaks fetchmany when using excute(...,multi=True)
Submitted: 9 Apr 2021 12:25 Modified: 14 May 2021 9:46
Reporter: Daniel Fiske Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / Python Severity:S1 (Critical)
Version:>= 8.0.20 OS:Ubuntu
Assigned to: CPU Architecture:x86

[9 Apr 2021 12:25] Daniel Fiske
Description:
We see similar behaviour when iterating over fetchmany(size=1) as

https://bugs.mysql.com/bug.php?id=93510
https://bugs.mysql.com/bug.php?id=97953
https://bugs.mysql.com/bug.php?id=97830

Where repeat calls to fetchmany(size=1) does not advance the cursor and repeatedly returns the same record. This seems specific to calls to execute where multi=True.

The behavior seems to have been introduce in 8.0.20 by http://github.com/mysql/mysql-connector-python/pull/54 which is a change that is not logically equivalent

How to repeat:
Code of this form where the stored procedure may have mutiple statements seems to endlessly iterate.

results = mycursor.execute("CALL some_stored_procedure()", multi=True)
for cur in results:
    if cur.with_rows:
        lines = cur.fetchmany(size=1)
        while len(lines) > 0:
            for l in lines:
                print(l)
            lines = cur.fetchmany(size=1)

Suggested fix:
https://github.com/mysql/mysql-connector-python/compare/master...zabullet:master

The solution needs more testing and test cases to cover it and make sure there aren't reversions.
[10 Apr 2021 9:34] MySQL Verification Team
Hello Daniel Fiske,

Thank you for the report and feedback.
Could you provide us with python test script(along with logical dump of stored procedure,table etc) to help us reproduce the bug? Thank you.

regards,
Umesh
[10 Apr 2021 21:08] Daniel Fiske
Struggling to get the unit tests up and running

https://bugs.mysql.com/bug.php?id=103273

Is there a preferred distribution to get them running on?
[15 May 2021 1: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".