Closed MAKOMO closed 7 months ago
I am not sure I understand what the problem is? reading the description the behavior is what I expected.
Please make it a bit clearer what does not work as expected.
Shouldn't client retries only happen on errors? Here there is a communication without error and still it takes always all retries while the first request already succeeds.
I added the debug configuration also to the client and added also the debug output for the client. Interestingly, even on retry_on_invalid=False
there is an internal Incomplete message received, Expected 1024 bytes Received 11 bytes !!!!
while the correct result is still returned without an error. Is this really the behavior that you expected?
It depends whether the 11 bytes is a valid message, let me check.
And yes retry is only on errors.
Versions
Pymodbus Specific
Description
A
ModbusUdpClient
withretry_on_invalid=True
andretries=n
seems to retry exactlyn
times in any case.Code and Logs
The following server serves one register value via UDP on localhost and prints a line on each received request for data.
server.py
Accessing this server with the following client with 3 retries and
retry_on_invalid=True
receives the register value correctly and prints showing the retries happening, which is strange as there is actually no failure accessing that register from the server running locally as can see if one starts the client with
retry_on_invalid=True
orretries=0
.On the server it logs 4 reads for this one client request:
With
retry_on_invalid=False
or using the TCP client and server, just one request is received by the server.UDP client output with client configured using
retry_on_invalid=False
(just one request sent without any retry, which completed without returning an error returning the correct result):UDP server output with client configured using
retry_on_invalid=False
(just one request received and answered):This behavior can be observed with pymodbus v3.3.1 and newer. For pymodbus v3.0.2 and earlier just one request is received by a client with
retry_on_invalid=True
.