Skip to content

Unable to detect log changes after running for a long time. #636

@thcpdd

Description

@thcpdd

Description

When I run a script that monitors binlog changes for a long time, the stream object may not be able to pull the relevant events until I restart the script.

Here is some of my code:

log_pos, log_file = "mysql-bin.000004", 928361
stream = BinLogStreamReader(
    connection_settings=connection_settings, 
    server_id=server_id,
    only_events=[WriteRowsEvent, UpdateRowsEvent, DeleteRowsEvent],
    only_schemas=["dbname"],
    only_tables=['table1', 'table2'],
    blocking=True,
    resume_stream=True,
    log_pos=log_pos,
    log_file=log_file
)

# start to listen
for event in stream:
    ...

When the script first runs, it can listen to all log information.
However, after running for a while, for example, 30 minutes or an hour, this listener will stop working(But it won't report an error). In other words, when the data in the relevant table changes, the for loop will not respond. It only works again after I restart the script.

Related Information

  • Platform: Ubuntu Or Windows 11
  • MySQL Version: 5.7
  • Python Version: 3.11
  • python-mysql-replication Version: 0.46

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions