Skip to content

FifoTransactionManager: Transaction never removed after errorCallback #159

@submerged15

Description

@submerged15

Hi,

I'm using pymodbus over RS485 with RtuFramer and AsyncModbusProtocol based on the twisted serialport. (Python 2.7)

Whenever there are multiple slaves attached and one of them is disabled, there is a reponse/transaction mismatch. The request of the disabled slave never return any response and any further requests with any other slaves too. No timeout is ever reached and I have to call the errorCallback manually.

I figured out that, after the errorCallback is called, the TransactionManager (RtuFramer uses FifoTransactionManager) still contains the failed deferred. Any future request with valid response tries to match with that failed deferred and therefore discard the response. The FifoTransactionManager tries always to match the first element of the list and not the x element based on the Transaction-ID.

def getTransaction(self, tid):
_logger.debug("getting transaction %s" % str(tid))
return self.transactions.pop(0) if self.transactions else None

Workaround: Delete the failed transaction in my errorCallback method.

Solution: Add handling for failed requests.

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