Commit 65285b4
Fix data race in internal/cluster/routingtable/update.go
There is a data race between routing tables update go-routines when tests are
ran with `-race` flag:
```
WARNING: DATA RACE
Write at 0x00c00040ec20 by goroutine 298:
github.com/olric-data/olric/internal/cluster/routingtable.(*RoutingTable).updateRoutingTableOnCluster.(*Members).Range.(*RoutingTable).updateRoutingTableOnCluster.func1.func2()
/home/maxim/.local/go/pkg/mod/github.com/olric-data/[email protected]/internal/cluster/routingtable/update.go:88 +0xeb
golang.org/x/sync/errgroup.(*Group).Go.func1()
/home/maxim/.local/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:93 +0x86
Previous read at 0x00c00040ec20 by goroutine 297:
github.com/olric-data/olric/internal/cluster/routingtable.(*RoutingTable).updateRoutingTableOnCluster.(*Members).Range.(*RoutingTable).updateRoutingTableOnCluster.func1.func2()
/home/maxim/.local/go/pkg/mod/github.com/olric-data/[email protected]/internal/cluster/routingtable/update.go:88 +0x12f
golang.org/x/sync/errgroup.(*Group).Go.func1()
/home/maxim/.local/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:93 +0x86
```
Same captured `err` variable is shared between several go-routines.1 parent 23297a6 commit 65285b4
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
0 commit comments