Probably avoidable (unclear) IndexError when connecting.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MySQL Connector/Python |
New
|
Undecided
|
Unassigned |
Bug Description
CLIENT:
python 3.1.1 + mysql connector 0.1.3
Linux pixel 2.6.31.3-nogo-pixel #1 SMP PREEMPT Mon Dec 7 01:14:18 EST 2009 i686 Intel(R) Core(TM)2 CPU U7600 @ 1.20GHz GenuineIntel GNU/Linux
SERVER:
Server version: 5.1.39-
Linux oneohone 2.6.18-6-amd64 #1 SMP Fri Dec 12 05:49:32 UTC 2008 x86_64 GNU/Linux
I am not sure what exactly causes the below problem, but I can pretty good predict /when/ it will happen:
I open a ssh tunnel to the mysql server and use this in the ~/.ssh/config:
LocalForward 10101 127.0.0.1:3306
I open a db connection with python to 127.0.0.1 port 10101.
I put my notebook to standby <<< here I am not sure if the above connection is still open or already closed.
The next morning I power on the notebook the ssh connection still sits there but timed out.
If I now try to connect with python to 127.0.0.1 port 10101 I get the below traceback.
If I then reestablish the ssh tunnel everything works fine.
But if I try to connect to 127.0.0.1 port 10101 with no ssh tunnel established, I get a nice and clean:
mysql.connector
Traceback (most recent call last):
File "/home/
import cypra.dl.db as db
File "/home/
import cypra.dblogger as log
File "/home/
__LOG_DB_CONN__ = db.connect(
File "/usr/lib/
return MySQL(*args, **kwargs)
File "/usr/lib/
self.
File "/usr/lib/
self.
File "/usr/lib/
self.
File "/usr/lib/
buf = self.recv()[0]
File "/usr/lib/
(pktsize, pktnr) = self.protocol.
File "/usr/lib/
pktnr = utils.int1read(
IndexError: index out of range
Any idea what causes this?
I confirmed: The problem occurs when you have established an ssh tunnel from host A to B (like described above).
Then host A looses network connection.
At this point the tunnel will stil appear in "netstat -tulpen".
But when you try to connect you don't get any response (maybe you have to wait REALLY long??!)
I waited about 1 minute or so and got stil no error message or what so ever from mysql.connector.
Then I closed the ssh connection (and so the tunnel vanished).
At this point you get the above cited "IndexError: index out of range".
So I am not sure if this is possible:
a) to make mysql.connector not wait so long (maybe infinite?) before it fails
b) create a nicer Exception