One of our users reports intermittent write: broken pipe errors. Unfortunately, errors are not resolved without restarting the application (i.e. forcing a new network connection).
Looking at https://github.com/grid-x/modbus/blob/master/tcpclient.go we seem to return on error, but never close the connection. It seems to defeat reconnecting since conn will never be nil.
If this hunch is right: how should broken network connections be handled? Would it make sense to force-close the connection on any failed read or write like this:
One of our users reports intermittent
write: broken pipe
errors. Unfortunately, errors are not resolved without restarting the application (i.e. forcing a new network connection). Looking at https://github.com/grid-x/modbus/blob/master/tcpclient.go we seem to return on error, but never close the connection. It seems to defeat reconnecting sinceconn
will never benil
.If this hunch is right: how should broken network connections be handled? Would it make sense to force-close the connection on any failed read or write like this: