Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result length not requested length #226

Closed
nghiaminhle opened this issue Aug 30, 2017 · 5 comments
Closed

Result length not requested length #226

nghiaminhle opened this issue Aug 30, 2017 · 5 comments

Comments

@nghiaminhle
Copy link

nghiaminhle commented Aug 30, 2017

Dear all,

Today, i've got a exception:
Result length not requested length:
Expected=8643. Actual=6. Position: 595. Data Length: 601

The exception tracing:
Result length not requested length:
Expected=8643. Actual=6. Position: 595. Data Length: 601
Traceback (most recent call last):

for row in binlogevent.rows:
File "/python3.6/site-packages/pymysqlreplication/row_event.py", line 428, in rows
self._fetch_rows()
File "/python3.6/site-packages/pymysqlreplication/row_event.py", line 423, in _fetch_rows
self.__rows.append(self._fetch_one_row())
File "/python3.6/site-packages/pymysqlreplication/row_event.py", line 512, in _fetch_one_row
row["before_values"] = self._read_column_data(self.columns_present_bitmap)
File "/python3.6/site-packages/pymysqlreplication/row_event.py", line 130, in _read_column_data
values[name] = self.__read_string(2, column)
File "/python3.6/site-packages/pymysqlreplication/row_event.py", line 218, in __read_string
string = self.packet.read_length_coded_pascal_string(size)
File "/python3.6/site-packages/pymysqlreplication/packet.py", line 253, in read_length_coded_pascal_string
return self.read(length)
File "/python3.6/site-packages/pymysqlreplication/packet.py", line 153, in read
return self.packet.read(size)
File "/python3.6/site-packages/pymysql/connections.py", line 250, in read
raise AssertionError(error)
AssertionError: Result length not requested length:
Expected=8643. Actual=6. Position: 595. Data Length: 601

When i remove the update rows event, the problem is gone away.
My configuration:

stream = BinLogStreamReader(
                connection_settings=mysql_settings,
                server_id=121
                ,only_events=[DeleteRowsEvent, WriteRowsEvent, UpdateRowsEvent]
                ,freeze_schema = False
                ,log_file='bin.002877'
                ,log_pos=753583192
                ,resume_stream = True
                ,auto_position = False
            )

I don't know the reason. Please help to figure out the solution for this solution

@baloo
Copy link
Collaborator

baloo commented Dec 14, 2017

can you share the pymysql verion and the version of pymysqlreplication?

@tferreira
Copy link

tferreira commented Jan 26, 2018

I just got the same issue with WriteRowsEvent.

mysql-replication==0.15
PyMySQL==0.8.0

I tried with older versions of PyMySQL but had the same errors.

Repository owner deleted a comment from coldfire-x Jan 26, 2018
@lumenghe
Copy link

lumenghe commented Oct 7, 2019

I got the same error with

mysql-replication==0.19
PyMySql==0.9.2

juravlikk pushed a commit to juravlikk/python-mysql-replication that referenced this issue Dec 13, 2019
…onchelle#298

In case of large JSON documents leteral values should be retrieved with
`read_uint32` instead of `read_uint32` to avoid further AssertionError
@juravlikk
Copy link

Got the same with

mysql-replication==0.19
PyMySql==0.8.2

After some investigation found that it doesn't depend on the library version and caused by wrong value retrieving for JSONB_TYPE_LITERAL type (true, false, null). It occurs only for large JSON documents and works well for small.
https://github.com/noplay/python-mysql-replication/blob/master/pymysqlreplication/packet.py#L389

I've raised PR to fix this - #307

baloo pushed a commit that referenced this issue Dec 14, 2019
In case of large JSON documents leteral values should be retrieved with
`read_uint32` instead of `read_uint32` to avoid further AssertionError
@baloo baloo closed this as completed Dec 14, 2019
@MintooJinnu
Copy link

MintooJinnu commented Feb 18, 2024

The above issue is not specifically raised for JSON Literal method correct? It is still happening in reading varchar data(read_length_coded_pascal_string) @baloo for your refereference #610

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants