From 03d43fb5a25e9c62cc3662c11e05c2bb7c00d651 Mon Sep 17 00:00:00 2001 From: TossPig Date: Thu, 14 Sep 2023 05:05:59 +0800 Subject: [PATCH] [load][windows] Fix DATA RACE in load. Avg() fixed #1526 --- load/load_windows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/load/load_windows.go b/load/load_windows.go index b48483849..8f53efae3 100644 --- a/load/load_windows.go +++ b/load/load_windows.go @@ -45,8 +45,8 @@ func loadAvgGoroutine(ctx context.Context) { f := func() { currentLoad, err = counter.GetValue() - loadErr = err loadAvgMutex.Lock() + loadErr = err loadAvg1M = loadAvg1M*loadAvgFactor1M + currentLoad*(1-loadAvgFactor1M) loadAvg5M = loadAvg5M*loadAvgFactor5M + currentLoad*(1-loadAvgFactor5M) loadAvg15M = loadAvg15M*loadAvgFactor15M + currentLoad*(1-loadAvgFactor15M)