From 0d0da27a95ff198807b15f57d39bd83e410b2a94 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Tue, 27 Feb 2024 17:22:51 +0100 Subject: [PATCH 1/2] 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. Signed-off-by: Daniel Swarbrick --- aws/crr/cache.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aws/crr/cache.go b/aws/crr/cache.go index c07f6731ea7..eeb3bc0c5a0 100644 --- a/aws/crr/cache.go +++ b/aws/crr/cache.go @@ -8,12 +8,12 @@ import ( // based on some key. The datastructure makes use of a read write // mutex to enable asynchronous use. type EndpointCache struct { - endpoints syncMap - 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 syncMap + endpointLimit int64 } // NewEndpointCache will return a newly initialized cache with a limit From a49c26df70f46e11d40e9de55707df634857ec52 Mon Sep 17 00:00:00 2001 From: Luc Talatinian Date: Fri, 24 May 2024 13:03:32 -0400 Subject: [PATCH 2/2] add changelog --- CHANGELOG_PENDING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 8a1927a39ca..6d790d4df98 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -3,3 +3,5 @@ ### SDK Enhancements ### SDK Bugs +* Fix misaligned struct member used in atomic operation. + * This change fixes panics on 32-bit systems in services that use endpoint discovery.