lib/vmselectapi: extend error handling to ignore "reset by peer" (#4498)

This is a followup for https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4418 to also handle "connection reset by peer" errors in connection handling logic.
This error can be triggered just the same as described in original PR: when query was closed on vmselect side and connection has been interrupted.

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
This commit is contained in:
Zakhar Bessarab 2023-06-22 13:24:18 +04:00 committed by GitHub
parent 88ac6116bd
commit bf4120a3d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -257,7 +257,9 @@ func (s *Server) processConn(bc *handshake.BufferedConn) error {
// Remote client gracefully closed the connection.
return nil
}
if errors.Is(err, net.ErrClosed) || strings.Contains(err.Error(), "broken pipe") {
if errors.Is(err, net.ErrClosed) ||
strings.Contains(err.Error(), "broken pipe") ||
strings.Contains(err.Error(), "connection reset by peer") {
// The connection has been interrupted abruptly.
// It could happen due to unexpected network glitch or because connection was
// interrupted by remote client. In both cases, remote client will notice