Skip to content

TCP error handling #11

@andig

Description

@andig

@gq0 in goburrow/modbus#25 (comment) you were so kind to help with tcp recovery parameters. I've switched to grid-x and am still having some problems getting a stable connection to SE9k. I'm using these parameters:

handler.Timeout = 300 * time.Millisecond
handler.ProtocolRecoveryTimeout = 10 * time.Second
handler.LinkRecoveryTimeout = 60 * time.Second

Still, recovery does only work sometimes:

17:23:33 modbus: send 18 fc 00 00 00 06 01 03 9c 95 00 02
17:23:33 modbus: send 18 fc 00 00 00 06 01 03 9c 95 00 02
17:23:38 modbus: send 18 fc 00 00 00 06 01 03 9c 95 00 02
17:23:48 Device 1 failed to retrieve opcode 0x9c95, error was: read tcp 192.168.178.36:34614->192.168.178.5:502: i/o timeout
17:23:48 Device 1 failed to respond - retry attempt 1 of 5
17:23:48 modbus: send 18 fd 00 00 00 06 01 03 9c 95 00 02
17:23:48 modbus: send 18 fd 00 00 00 06 01 03 9c 95 00 02
17:23:48 modbus: send 18 fd 00 00 00 06 01 03 9c 95 00 02
17:23:48 modbus: send 18 fd 00 00 00 06 01 03 9c 95 00 02
17:23:48 modbus: send 18 fd 00 00 00 06 01 03 9c 95 00 02
17:23:48 modbus: recv 18 fd 00 00 00 07 01 03 04 13 87 ff fe
17:23:48 Device 1 - Frequency: 49.99

Whereas often it does not work:

broken pipe:

03:46:43 modbus: send 12 f3 00 00 00 06 01 03 9c 8f 00 04
03:46:43 Device 1 failed to retrieve opcode 0x9c8f, error was: read tcp 192.168.178.36:60398->192.168.178.5:502: read: connection reset by peer
03:46:43 Device 1 failed to respond - retry attempt 1 of 5
03:46:43 modbus: send 12 f4 00 00 00 06 01 03 9c 8f 00 04
03:46:43 Device 1 failed to retrieve opcode 0x9c8f, error was: write tcp 192.168.178.36:60398->192.168.178.5:502: write: broken pipe
03:46:43 Device 1 failed to respond - retry attempt 2 of 5

i/o timeout:

17:24:24 modbus: send 19 0e 00 00 00 06 01 03 9c 9d 00 03
17:24:24 modbus: send 19 0e 00 00 00 06 01 03 9c 9d 00 03
17:24:24 modbus: send 19 0e 00 00 00 06 01 03 9c 9d 00 03
17:24:34 Device 1 failed to retrieve opcode 0x9c9d, error was: read tcp 192.168.178.36:34614->192.168.178.5:502: i/o timeout
17:24:34 Device 1 failed to respond - retry attempt 1 of 5
17:24:34 modbus: send 19 0f 00 00 00 06 01 03 9c 9d 00 03
17:24:44 Device 1 failed to retrieve opcode 0x9c9d, error was: read tcp 192.168.178.36:34614->192.168.178.5:502: i/o timeout
17:24:44 Device 1 failed to respond - retry attempt 2 of 5
17:24:44 modbus: send 19 10 00 00 00 06 01 03 9c 9d 00 03

I would appreciate any hints how to improve error handling- is there anything that needs to be done on client side? Are the parameter values ok?

Metadata

Metadata

Assignees

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