do not share err variable between goroutines - it could cause panics on unwrapping

This commit is contained in:
Andrei Baidarov 2024-11-20 14:07:34 +01:00
parent 9414c5cfaa
commit 30a871b9c4
No known key found for this signature in database
GPG key ID: 411A230F02C31DFD

View file

@ -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)