Reading fields can sometimes lead to an IndexError
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MySQL Connector/Python |
Confirmed
|
Medium
|
Geert JM Vanderkelen |
Bug Description
Got it reproduced in an app, but trying to make a smaller test case it works OK..
None: 03 d e f 00 06 T A B L E S 00 0a T A B L E _ N A M E 0a T A B L E _ N A M E 0c ! 00 c0 00 00 00 fd 01 00 00 00 00
None: 03 d e f 00 06 T A B L E S 00 0c T A B L E _ S C H E M A 0c T A B L E _ S C H E M A 0c ! 00 c0 00 00 00 fd 01 00 00 00 00
None: fe 00 00 20 00
Traceback (most recent call last):
File "prodemot.py", line 78, in <module>
main()
File "prodemot.py", line 72, in main
test_
File "prodemot.py", line 56, in test_demotion_int
wait_
File "prodemot.py", line 42, in wait_table_exists
slave.
File "prodemot.py", line 30, in table_exists
cur.
File "/Users/
res = self.db(
File "/Users/
return func(*args, **kwargs)
File "/Users/
return self.handle_
File "/Users/
return self._handle_
File "/Users/
return func(*args, **kwargs)
File "/Users/
return func(*args,
File "/Users/
fields.
File "/Users/
return func(*args,
File "/Users/
(buf,
File "python2/
mysql.connector
This bug is affecting us intermittently. We haven't yet gotten to the bottom of it but I wrapped the buffer read in protocol. _handle_ resultset in a try/except IndexError to print out the number of fields it is expecting:
(approx line 407 on build 292)
fields. append( self._pkt_ parse_field( buf))
import sys
buf = self.conn.recv()
try:
except IndexError:
data = dict(i=i, nrflds=nrflds, buf=buf)
print >> sys.stderr, 'Failed reading packet, data: %s' % data
raise
Checking the output, the nrflds varies but is most consistently 131072. This led me to believe this was related to a thread stack overflow but again this is not confirmed. Other values that have been returned:
24
535
626
795
1211
1347
I am using python 2.6.5 on ubuntu 10.04 64-bit and Percona patched Mysql 5.1.54.
Also note that the error isn't thrown in the exact same place. For me stack is:
http:// pastie. org/2994223