Skip to content

Commit

Permalink
Fix misaligned struct member used in atomic operation
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dswarbrick committed Feb 27, 2024
1 parent b6d006c commit 0d0da27
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions aws/crr/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0d0da27

Please sign in to comment.