Skip to content

TransactionManager automatically closes connection after consecutive timeouts while polling multiple slaves #3012

Description

@marshfolx

Versions

  • Python: 3.11.9
  • OS: Win11
  • Pymodbus: 3.15.0

Pymodbus Specific

  • Client: rtu - async

Description

I was polling multiple slave addresses (1 - 10) to see how many slaves are connected. After several consecutive timeouts, the connection is automatically dropped, and subsequent requests immediately fail because there is no active connection.

I think this behavior should be disabled by default:

  1. The sync client (v.3.12) does not do so;
  2. It was a surprise to me;
  3. This logic should be explicitly handled by the application.

Workaround

Delete the following code in TransactionManager:

            if self.count_until_disconnect < 0:
                self.connection_lost(asyncio.TimeoutError("Server not responding"))
                raise ModbusIOException(
                    "ERROR: No response received of the last requests (default: retries+3), CLOSING CONNECTION."
                )
            self.count_until_disconnect -= 1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions