From 30a871b9c4dad66de5989e24e4653d5004613c97 Mon Sep 17 00:00:00 2001 From: Andrei Baidarov Date: Wed, 20 Nov 2024 14:07:34 +0100 Subject: [PATCH] do not share err variable between goroutines - it could cause panics on unwrapping --- app/vmselect/netstorage/netstorage.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/vmselect/netstorage/netstorage.go b/app/vmselect/netstorage/netstorage.go index 764d59473..7cc0b5c0b 100644 --- a/app/vmselect/netstorage/netstorage.go +++ b/app/vmselect/netstorage/netstorage.go @@ -1888,6 +1888,8 @@ func processBlocks(qt *querytracer.Tracer, sns []*storageNode, denyPartialRespon } // Send the query to all the storage nodes in parallel. snr := startStorageNodesRequest(qt, sns, denyPartialResponse, func(qt *querytracer.Tracer, workerID uint, sn *storageNode) any { + // Use a separate variable for each goroutine + var err error res := execSearchQuery(qt, sq, func(qt *querytracer.Tracer, rd []byte, _ storage.TenantToken) any { sn.searchRequests.Inc() err = sn.processSearchQuery(qt, rd, f, workerID, deadline)