modbus
modbus copied to clipboard
Error: response transaction id does not match request
If you leave this driver running long enough, you get this:
2020-08-21T12:36:40Z I! [inputs.modbusgw] Modbus Error: modbus: response transaction id '51219' does not match request '51220'
2020-08-21T12:36:40Z I! [inputs.modbusgw] Modbus Error: modbus: response transaction id '51220' does not match request '51221'
2020-08-21T12:36:40Z I! [inputs.modbusgw] Modbus Error: modbus: response transaction id '51221' does not match request '51222'
forever. I have seen this type of thing before... I think the normal fix is to make sure that if you get a transaction with a transaction ID earlier than the one you requested, recognize that it's old and throw it away.
What causes this is network delay. You launch a poll, you don't get a response within some timeout, and so you launch a second poll, then the response to the first one comes in. At that point, this connection is ruined forever as this driver is currently written, it will always be one transaction out of step.
You can somewhat mitigate this by making the timeout longer, but you don't want long timeouts that wait forever before retrying. So that's a workaround for now but it's definitely NOT a long-term solution.
Is this project still being maintained? If it's not, I'll fork it and fix this myself. The telegraf modbus plugin uses this, which is why I want it fixed.
This is resolved by #65 (if accepted)