私はMysqlを使用してPython 2.7でマルチスレッドプログラムを持っています.私のマルチスレッドプログラムでは、スレッドの一般的な機能は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
このような接続を渡すと問題が発生しますか、それとも何か他のものですか??