diff --git a/lib/vmselectapi/server.go b/lib/vmselectapi/server.go index b0c393bd5..d06b93f6b 100644 --- a/lib/vmselectapi/server.go +++ b/lib/vmselectapi/server.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "net" + "strings" "sync" "sync/atomic" "time" @@ -256,6 +257,13 @@ func (s *Server) processConn(bc *handshake.BufferedConn) error { // Remote client gracefully closed the connection. return nil } + if err == net.ErrClosed || strings.Contains(err.Error(), "broken pipe") { + // 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 + // connection breach and handle it on its own. No need in mirroring the error here. + return nil + } if errors.Is(err, storage.ErrDeadlineExceeded) { return fmt.Errorf("cannot process vmselect request in %d seconds: %w", ctx.timeout, err) }