Skip to content

Commit 73899c3

Browse files
authored
Fix data race in ds (pingcap#1161)
close pingcap#1160
1 parent 95a7800 commit 73899c3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

utils/dynstream/parallel_dynamic_stream.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ func (s *parallelDynamicStream[A, P, T, D, H]) Start() {
8383
}
8484

8585
func (s *parallelDynamicStream[A, P, T, D, H]) Close() {
86+
// clean pathMap, to avoid sending into a closed channel after close()
87+
{
88+
s.pathMap.Lock()
89+
for k := range s.pathMap.m {
90+
delete(s.pathMap.m, k)
91+
}
92+
s.pathMap.Unlock()
93+
}
94+
8695
for _, ds := range s.streams {
8796
ds.close()
8897
}

0 commit comments

Comments
 (0)