Bug #64393 Lost connection causes infinite loop when reading rows

Submitted: 21 Feb 2012 10:17 Modified: 8 Aug 2012 4:48
Reporter: Geert Vanderkelen Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / Python Severity:S2 (Serious)
Version:0.3.2 OS:Any
Assigned to: Geert Vanderkelen CPU Architecture:Any

[21 Feb 2012 10:17] Geert Vanderkelen
Description:
When the connection is lost and a cursor still has unread result set, an infinite loop is triggered in the recv_plain() method.

How to repeat:
import time
import mysql.connector

def main():
    cnx = mysql.connector.connect(user='root',database='test')
    cnx2 = mysql.connector.connect(user='root',database='mysql')

    cur = cnx.cursor()
    # Bad query
    cur.execute("SELECT * FROM mysql.time_zone AS t1 JOIN mysql.time_zone AS t2")

    cur2 = cnx2.cursor()
    cur2.execute("KILL %d" % cnx.connection_id)

    for row in cur:
        print(row)

    cur.close()
    cnx.close()
    cur2.close()
    cnx2.close()
[8 Aug 2012 4:48] Geert Vanderkelen
Fixed with Connector/Python v1.0.5 beta release.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.