Closed methane closed 8 years ago
Do you think for our special case we should use your library or embed our own packet reading code?
@methane, I also have this error ( mysql error sql: Packet sequence number wrong - got 1 expected 2, ) and I didn't understand your comment. Can you try to explain again. I didn't know where I must use "_next_seq_id" or "_read_packet". I use pymysql version 0.7.1
Use the last version from git it should work.
Le mer. 3 févr. 2016 à 08:26, ulugbekrozimboyev notifications@github.com a écrit :
@methane https://github.com/methane, I also have this error ( mysql error sql: Packet sequence number wrong - got 1 expected 2, ) and I didn't understand your comment. Can you try to explain again. I didn't know where I must use "_next_seq_id" or "_read_packet"
— Reply to this email directly or view it on GitHub https://github.com/noplay/python-mysql-replication/issues/138#issuecomment-179063868 .
i see the same error with pymysql 0.7.2
I can confirm it works great with master version of python-mysql-replication and pymysql 0.7.2
@noplay However,it does not work well even with version of 0.7.11.Here goes my debug info: update table info..... Exception in thread Thread-2: Traceback (most recent call last): File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/usr/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "main.py", line 44, in consumeTask tasks=self.database.get_offline_unfinish_task() File "/home/jiangminghao/sourcecode/Field_Rule_Analyse/Database.py", line 48, in get_offline_unfinish_task cursor.execute("select params,id from s9_offline_task where status=0") File "/usr/local/lib/python3.5/dist-packages/pymysql/cursors.py", line 166, in execute result = self._query(query) File "/usr/local/lib/python3.5/dist-packages/pymysql/cursors.py", line 322, in _query conn.query(q) File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py", line 856, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py", line 1057, in _read_query_result result.read() File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py", line 1340, in read first_packet = self.connection._read_packet() File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py", line 1001, in _read_packet % (packet_number, self._next_seq_id)) pymysql.err.InternalError: Packet sequence number wrong - got 1 expected 19
@jmhIcoding It seems your multi threading bug. You can't use same connection from multiple threads simultaneously.
PyMySQL starts checking packet sequence number. You should set expecting sequence number to
connection._next_seq_id
before callingconnection._read_packet()
.I don't make a public low level API for now. Since I want to make PyMySQL faster with C speedup module in the future and fixing low level API prevent it.