From 2622e642136ad98a8288a6516e37a7fa67dafef9 Mon Sep 17 00:00:00 2001 From: mathiasme Date: Sat, 1 Jan 2022 16:40:56 +0000 Subject: [PATCH 1/2] Patched atomic calculation issue with 32 bits ARM architectures Server was not working on my raspberry Pi. Appears the issue is related to the Go compiler (https://github.com/golang/go/issues/599). As read here https://github.com/census-instrumentation/opencensus-go/issues/587 , I switched these two lines in the counter struct and it now works. --- metrics/metrics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metrics/metrics.go b/metrics/metrics.go index 551d340..bd73126 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -10,8 +10,8 @@ import ( ) type counter struct { - startTime time.Time count uint64 + startTime time.Time } // Counter providers a threadsafe counter to use for storing long running counts From c75d25f1c09a4dbe588c8ad8a544559bf2895a8c Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 4 Jan 2022 11:43:51 -0500 Subject: [PATCH 2/2] document mathiasme fix --- metrics/metrics.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/metrics/metrics.go b/metrics/metrics.go index bd73126..3966d23 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -9,6 +9,10 @@ import ( "time" ) +// Fields must be in this order because go compiler has problems with 64bit fields on 32 bit arches (arm32 raspberry pi): +// https://git.openprivacy.ca/cwtch.im/server/pulls/30 +// https://github.com/golang/go/issues/599 +// https://github.com/census-instrumentation/opencensus-go/issues/587 type counter struct { count uint64 startTime time.Time