Skip to content

Commit 1ad34b3

Browse files
authored
Fix misaligned struct member used in atomic operation (#2519)
1 parent 530583e commit 1ad34b3

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "448aaf15-09f4-48d3-85e5-c243933a39d8",
3+
"type": "bugfix",
4+
"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.",
5+
"modules": [
6+
"service/internal/endpoint-discovery"
7+
]
8+
}

service/internal/endpoint-discovery/cache.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import (
99
// based on some key. The data structure makes use of a read write
1010
// mutex to enable asynchronous use.
1111
type EndpointCache struct {
12-
endpoints sync.Map
13-
endpointLimit int64
1412
// size is used to count the number elements in the cache.
1513
// The atomic package is used to ensure this size is accurate when
1614
// using multiple goroutines.
17-
size int64
15+
size int64
16+
endpoints sync.Map
17+
endpointLimit int64
1818
}
1919

2020
// NewEndpointCache will return a newly initialized cache with a limit

0 commit comments

Comments
 (0)