Skip to content

Commit 07c7893

Browse files
committed
possible deadlock fix
1 parent 1d012bd commit 07c7893

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

cmd/migration-checker/main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,10 @@ func loadZkTrie(zkTrie *trie.ZkTrie, top, paranoid bool) chan map[string][]byte
257257
}, func(f func()) {
258258
<-trieLoaders
259259
go func() {
260+
defer func() {
261+
trieLoaders <- struct{}{}
262+
}()
260263
f()
261-
trieLoaders <- struct{}{}
262264
}()
263265
}, parallelismCutoffDepth, paranoid)
264266
zkDone <- zkLeafMap

trie/zk_trie.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ func (t *ZkTrie) countLeaves(depth int, root *zkt.Hash, cb func(key, value []byt
272272
return 1
273273
} else {
274274
if depth < parallelismCutoffDepth {
275-
count := make(chan uint64)
275+
count := make(chan uint64, 1)
276276
leftT := t.Copy()
277277
rightT := t.Copy()
278278
go func() {

0 commit comments

Comments
 (0)