Lost connection causes infinite loop
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MySQL Connector/Python |
Triaged
|
Critical
|
Geert JM Vanderkelen |
Bug Description
If the connection to MySQL is lost, the connector goes into an infinite loop in recv_plain. By contrast, MySQLdb reports _mysql_
To recreate:
1. In python, submit a query that returns a large data set (100K total bytes or 50,000 rows should be enough.)
2. Do nothing yet with the returned object. Instead, go to MySQL interface, and run SHOW PROCESSLIST every minute or so. Eventually, the query will go away when MySQL times out on a send.
3. Go back to python and try to use the rows.
Versions:
python -c "import mysql.connector as db; print db.__version__"
(0, 3, 2, 'devel', 292)
python --version
Python 2.7.1
mysql -NB -e "SELECT VERSION()"
5.1.30-community
uname -a
Linux xxxxx.xxxxx.com 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
Related branches
Changed in myconnpy: | |
assignee: | nobody → Geert JM Vanderkelen (geertjmvdk) |
Changed in myconnpy: | |
importance: | High → Critical |
Changed in myconnpy: | |
status: | Confirmed → Fix Committed |
milestone: | none → 0.4 |
Code to reproduce:
import time
import mysql.connector
def bug809033(): .connect( user='root' ,database= 'test') .connect( user='root' ,database= 'mysql' )
cnx = mysql.connector
cnx2 = mysql.connector
cur = cnx.cursor() execute( "SELECT * FROM mysql.time_zone AS t1 JOIN mysql.time_zone AS t2")
# Bad query
cur.
cur2 = cnx2.cursor() execute( "KILL %d" % cnx.connection_id)
cur2.
for row in cur:
print(row)
cur.close()
cnx.close()
cur2.close()
cnx2.close()