Skip to content

Commit 418b072

Browse files
fix(core): fix map iterate concurrency panic in vm-route-forge (#1602)
Signed-off-by: Maksim Fedotov <maksim.fedotov@flant.com> Signed-off-by: Yaroslav Borbat <yaroslav.borbat@flant.com> Co-authored-by: Yaroslav Borbat <yaroslav.borbat@flant.com>
1 parent 691650e commit 418b072

File tree

1 file changed

+2
-0
lines changed
  • images/vm-route-forge/internal/cache

1 file changed

+2
-0
lines changed

images/vm-route-forge/internal/cache/cache.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ func (c *defaultCache) DeleteByIP(ip net.IP) {
8787
}
8888

8989
func (c *defaultCache) Iterate(fn func(k types.NamespacedName, v Addresses) (next bool)) {
90+
c.mu.RLock()
91+
defer c.mu.RUnlock()
9092
for k, v := range c.vmAddr {
9193
if next := fn(k, v); !next {
9294
break

0 commit comments

Comments
 (0)