MySQLConnection.disconnect() fails on dead connection
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MySQL Connector/Python |
Confirmed
|
Medium
|
Geert JM Vanderkelen |
Bug Description
MySQL Connector/Python version 0.3.2 with Python 3.2:
Within class MySQLConnection:
.connect() calls .disconnect() triggers a signal 13 if the connection is dead!
--> put a try: self.disconnect()
except: pass
in .connect() and .connect() works as the .reconnect() I wanted ... except that
my reconnect will check is_connected AND have a semaphore around the .connect()
call to avoid race conditions between multiple cursors :)
... and actually looking at .disconnect() the signal 13 originates from the call
"self.protocol.
If I move this line into the try block you already have in .disconnect, the
signal 13 does not happen and the try, except around the .disconnect() call
within .connect() are not necessary.
Side note: The patch also fixes a wrong indentation:
Line 453 in connection.py:
self.collation = collation
within:
def _post_connectio
shows invalid indenting in my eclipse.
Changed in myconnpy: | |
status: | Incomplete → Confirmed |
importance: | Undecided → Medium |
Hey,
Thanks for reporting this bug!
I'm trying to reproduce this. If I understand the problem, if you kill the connection, you would get an error, right?
Something like this:
cnx = mysql.connector .connect( user='root' ) cnx.connection_ id) protocol. cmd_process_ kill(cnx. connection_ id) cnx.connection_ id)
print(
cnx.
cnx.connect()
print(
Could you get a small test case like the above?
Cheers,
Geert