diff --git a/.changelog/448aaf1509f448d385e5c243933a39d8.json b/.changelog/448aaf1509f448d385e5c243933a39d8.json new file mode 100644 index 00000000000..36970fc5c7e --- /dev/null +++ b/.changelog/448aaf1509f448d385e5c243933a39d8.json @@ -0,0 +1,8 @@ +{ + "id": "448aaf15-09f4-48d3-85e5-c243933a39d8", + "type": "bugfix", + "description": "Fix misaligned struct member used in atomic operation. This fixes a panic caused by attempting to atomically access a struct member which is not 64-bit aligned when running on 32-bit arch, due to the smaller sync.Map struct.", + "modules": [ + "service/internal/endpoint-discovery" + ] +} \ No newline at end of file diff --git a/service/internal/endpoint-discovery/cache.go b/service/internal/endpoint-discovery/cache.go index 14ee1723990..6abd3029c05 100644 --- a/service/internal/endpoint-discovery/cache.go +++ b/service/internal/endpoint-discovery/cache.go @@ -9,12 +9,12 @@ import ( // based on some key. The data structure makes use of a read write // mutex to enable asynchronous use. type EndpointCache struct { - endpoints sync.Map - endpointLimit int64 // size is used to count the number elements in the cache. // The atomic package is used to ensure this size is accurate when // using multiple goroutines. - size int64 + size int64 + endpoints sync.Map + endpointLimit int64 } // NewEndpointCache will return a newly initialized cache with a limit