From 2635211bf4f9192fceefbce6424a68d13e70ef55 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 8 Aug 2022 00:20:37 +0300 Subject: [PATCH] app/vmselect/netstorage: properly detect and log timeout errors when querying vmstorage from vmselect This change is based on https://github.com/VictoriaMetrics/VictoriaMetrics/pull/2937 Thanks to @isodude for the initial pull request. --- app/vmselect/netstorage/netstorage.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/vmselect/netstorage/netstorage.go b/app/vmselect/netstorage/netstorage.go index 6a207c9f1b..f74ee26bcb 100644 --- a/app/vmselect/netstorage/netstorage.go +++ b/app/vmselect/netstorage/netstorage.go @@ -9,6 +9,7 @@ import ( "math/rand" "net" "net/http" + "os" "regexp" "sort" "strings" @@ -1728,7 +1729,7 @@ func (sn *storageNode) execOnConn(qt *querytracer.Tracer, funcName string, f fun // since it may be broken. _ = bc.Close() } - if deadline.Exceeded() { + if deadline.Exceeded() || errors.Is(err, os.ErrDeadlineExceeded) { return fmt.Errorf("cannot execute funcName=%q on vmstorage %q with timeout %s: %w", funcName, remoteAddr, deadline.String(), err) } return fmt.Errorf("cannot execute funcName=%q on vmstorage %q: %w", funcName, remoteAddr, err)