From da402fbdfa53b51adf1281016573bd7b49af235c Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 3 Dec 2021 01:20:04 +0200 Subject: [PATCH] lib/workingsetcache: fix `unaligned 64-bit atomic operation` panic on 32-bit architectures The panic has been introduced in 7275ebf91a0c847a388c7d21656097d99a16414b --- docs/CHANGELOG.md | 2 ++ lib/workingsetcache/cache.go | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 755871ec5d..99865a468b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -10,6 +10,8 @@ sort: 15 * FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): allow specifying `http` and `https` urls in the following command-line flags: `-promscrape.config`, `-remoteWrite.relabelConfig` and `-remoteWrite.urlRelabelConfig`. * FEATURE: vminsert: allow specifying `http` and `https` urls in `-relabelConfig` command-line flag. +* BUGFIX: fix `unaligned 64-bit atomic operation` panic on 32-bit architectures, which has been introduced in v1.70.0. + ## [v1.70.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.70.0) diff --git a/lib/workingsetcache/cache.go b/lib/workingsetcache/cache.go index ff26470eda..b7fb296d10 100644 --- a/lib/workingsetcache/cache.go +++ b/lib/workingsetcache/cache.go @@ -25,6 +25,9 @@ type Cache struct { curr atomic.Value prev atomic.Value + // cs holds cache stats + cs fastcache.Stats + // mode indicates whether to use only curr and skip prev. // // This flag is set to switching if curr is filled for more than 50% space. @@ -39,9 +42,6 @@ type Cache struct { wg sync.WaitGroup stopCh chan struct{} - - // cs holds cache stats - cs fastcache.Stats } // Load loads the cache from filePath and limits its size to maxBytes