From 24154450e7d32ced1862d031fd296db443b85a2a Mon Sep 17 00:00:00 2001 From: Anton L Date: Thu, 22 Feb 2024 12:54:53 +0300 Subject: [PATCH] 5833 Fix Deadlock when using shardByURL of VMAgent (#5834) --- app/vmagent/remotewrite/remotewrite.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/vmagent/remotewrite/remotewrite.go b/app/vmagent/remotewrite/remotewrite.go index c2a6ee995d..70340b6888 100644 --- a/app/vmagent/remotewrite/remotewrite.go +++ b/app/vmagent/remotewrite/remotewrite.go @@ -436,12 +436,12 @@ func pushBlockToRemoteStorages(rwctxs []*remoteWriteCtx, tssBlock []prompbmarsha // Push sharded data to remote storages in parallel in order to reduce // the time needed for sending the data to multiple remote storage systems. var wg sync.WaitGroup - wg.Add(len(rwctxs)) for i, rwctx := range rwctxs { tssShard := tssByURL[i] if len(tssShard) == 0 { continue } + wg.Add(1) go func(rwctx *remoteWriteCtx, tss []prompbmarshal.TimeSeries) { defer wg.Done() rwctx.Push(tss)