From 9bb83cafa41b3fdf5afbaf074f408c6a44db4a79 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Tue, 21 Mar 2023 18:22:39 +0100 Subject: [PATCH] lib/netutil: log only parsing errors for proxy-protocol (#3985) * lib/netutil: log only parsing errors for proxy-protocol Previosly every error was logged. With configured TCP health checks at load-balancer or kubernetes, vmauth spams a lot of false positive error message into logs * Update docs/CHANGELOG.md Co-authored-by: Roman Khavronenko * Update lib/netutil/tcplistener.go Co-authored-by: Roman Khavronenko --------- Co-authored-by: Aliaksandr Valialkin Co-authored-by: Roman Khavronenko --- docs/CHANGELOG.md | 1 + lib/netutil/tcplistener.go | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f262ef197..443f4000d 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -31,6 +31,7 @@ created by v1.90.0 or newer versions. The solution is to upgrade to v1.90.0 or n * FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): automatically disable progress bar when TTY isn't available. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3823). * BUGFIX: prevent from slow [snapshot creating](https://docs.victoriametrics.com/#how-to-work-with-snapshots) under high data ingestion rate. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3551). +* BUGFIX: [vmauth](https://docs.victoriametrics.com/vmauth.html): suppress [proxy protocol](https://www.haproxy.org/download/2.3/doc/proxy-protocol.txt) parsing errors in case of `EOF`. Usually, the error is caused by health checks and is not a sign of an actual error. ## [v1.89.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.89.1) diff --git a/lib/netutil/tcplistener.go b/lib/netutil/tcplistener.go index e3288097c..900f20ed5 100644 --- a/lib/netutil/tcplistener.go +++ b/lib/netutil/tcplistener.go @@ -5,6 +5,7 @@ import ( "errors" "flag" "fmt" + "io" "net" "time" @@ -98,7 +99,9 @@ func (ln *TCPListener) Accept() (net.Conn, error) { if ln.useProxyProtocol { pConn, err := newProxyProtocolConn(conn) if err != nil { - proxyProtocolReadErrorLogger.Errorf("cannot read proxy proto conn for TCP addr %q: %s", ln.Addr(), err) + if !errors.Is(err, io.EOF) { + proxyProtocolReadErrorLogger.Errorf("cannot read proxy proto conn for TCP addr %q: %s", ln.Addr(), err) + } _ = conn.Close() continue }