Commit 5d5aaaa
fix: use lock when accessing mergeGateways Set (#7124)
* fix: use lock when accessing mergeGateways Set
* accessed in multiple goroutines to map proxy fleet to resource via
labels
Fixes this panic
```
fatal error: concurrent map read and map write
4 internal/runtime/maps.fatal({0x3b83570?, 0x8b3de58?})
5 /opt/hostedtoolcache/go/1.24.7/x64/src/runtime/panic.go:1058 +0x18
6 k8s.io/apimachinery/pkg/util/sets.Set[...[].Has(...)
7 /home/runner/go/pkg/mod/k8s.io/apimachinery@v0.33.3/pkg/util/sets/set.go:78
8 github.com/envoyproxy/gateway/internal/provider/kubernetes.(*gatewayAPIReconciler).envoyObjectForGateway.func1({0x8bc2dc8, 0xc0054163f0})
9 /home/runner/work/gateway/gateway/internal/provider/kubernetes/predicates.go:666 +0x7b
10 github.com/envoyproxy/gateway/internal/provider/kubernetes.(*gatewayAPIReconciler).envoyObjectForGateway(0xc0018858e8?, {0x8ba6648?, 0xc0009c8b90?}, 0x11?)
11 /home/runner/work/gateway/gateway/internal/provider/kubernetes/predicates.go:682 +0x5e
12 github.com/envoyproxy/gateway/internal/provider/kubernetes.(*gatewayAPIReconciler).updateStatusForGateway(0xc000516600, {0x8ba6648, 0xc0009c8b90}, 0xc00541a380)
13 /home/runner/work/gateway/gateway/internal/provider/kubernetes/status.go:579 +0x5a
14 github.com/envoyproxy/gateway/internal/provider/kubernetes.(*gatewayAPIReconciler).subscribeAndUpdateStatus.func2.1({{{0xc0096a7e46, 0x7}, {0xc001944cc0, 0x11}}, 0x0, 0xc0052fa690}, 0xc00a582a1 0)
```
Relates to #7115 (comment)
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
* lint
Signed-off-by: Arko Dasgupta <arko@tetrate.io>
---------
Signed-off-by: Arko Dasgupta <arko@tetrate.io>1 parent a88aa0e commit 5d5aaaa
File tree
3 files changed
+32
-13
lines changed- internal/provider/kubernetes
3 files changed
+32
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| |||
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
96 | 116 | | |
97 | 117 | | |
98 | 118 | | |
| |||
492 | 512 | | |
493 | 513 | | |
494 | 514 | | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
| 515 | + | |
500 | 516 | | |
501 | 517 | | |
502 | 518 | | |
| |||
1402 | 1418 | | |
1403 | 1419 | | |
1404 | 1420 | | |
1405 | | - | |
| 1421 | + | |
1406 | 1422 | | |
1407 | 1423 | | |
1408 | 1424 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
406 | | - | |
| 406 | + | |
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
644 | | - | |
| 644 | + | |
645 | 645 | | |
646 | 646 | | |
647 | 647 | | |
| |||
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
| 666 | + | |
| 667 | + | |
666 | 668 | | |
667 | 669 | | |
668 | | - | |
| 670 | + | |
669 | 671 | | |
670 | 672 | | |
671 | 673 | | |
| |||
697 | 699 | | |
698 | 700 | | |
699 | 701 | | |
700 | | - | |
| 702 | + | |
| 703 | + | |
701 | 704 | | |
702 | 705 | | |
703 | 706 | | |
| |||
955 | 958 | | |
956 | 959 | | |
957 | 960 | | |
958 | | - | |
| 961 | + | |
959 | 962 | | |
960 | 963 | | |
961 | 964 | | |
| |||
0 commit comments