我在python 2.7中有一个使用Mysql的多线程程序。在我的多线程程序中常见
线程的函数是process_submissions
。在那里我创建了专用连接
使用conn=pool.dedicated_connection()
。函数process_submissions
依次传递
此连接conn
到另一个函数rt_scripts
,它在表上查询(使用传递给它的连接)并返回process_submissions
。但是我收到以下错误:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "worker_with_threads3.py", line 20, in run
process_submission(self.name,self.q)
File "worker_with_threads3.py", line 47, in process_submission
cursor.execute(query)
File "/usr/local/lib/python2.7/dist-packages/DBUtils-1.1-py2.7.egg/DBUtils /SteadyDB.py", line 552, in tough_method
result = method(*args, **kwargs) # try to execute
File "/usr/lib/pymodules/python2.7/mysql/connector/cursor.py", line 314, in execute
res = self.db().protocol.cmd_query(stmt)
File "/usr/lib/pymodules/python2.7/mysql/connector/protocol.py", line 136, in deco
return func(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/mysql/connector/protocol.py", line 479, in cmd_query
return self.handle_cmd_result(self.conn.recv())
File "/usr/lib/pymodules/python2.7/mysql/connector/protocol.py", line 463, in handle_cmd_result
return self._handle_resultset(buf)[0:2]
File "/usr/lib/pymodules/python2.7/mysql/connector/protocol.py", line 62, in call
return func(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/mysql/connector/protocol.py", line 126, in call
return func(*args,**kwargs)
File "/usr/lib/pymodules/python2.7/mysql/connector/protocol.py", line 408, in _handle_resultset
fields.append(self._pkt_parse_field(buf))
File "/usr/lib/pymodules/python2.7/mysql/connector/protocol.py", line 126, in call
return func(*args,**kwargs)
File "/usr/lib/pymodules/python2.7/mysql/connector/protocol.py", line 289, in _pkt_parse_field
(buf,field['db']) = utils.read_lc_string(buf)
File "/usr/lib/pymodules/python2.7/mysql/connector/utils.py", line 170, in read_lc_string
if buf[0] == '\xfb':
InterfaceError: Failed executing the operation; string index out of range
可能是什么原因,像这样的传递连接会产生任何问题,或者是它 别的什么?