multi: ensure that BlockEpoch clients are cancelled
This commit fixes a prior goroutine leak that could result in a node having thousands of goroutines, particularly due to many concurrent channel fundings. We now ensure that for each BlockEpoch client created, we ensure that the client is cancelled once the creating grouting exits.
This commit is contained in:
parent
916ab454c1
commit
7be039adec
@ -1210,6 +1210,8 @@ func (f *fundingManager) waitForFundingWithTimeout(completeChan *channeldb.OpenC
|
||||
return
|
||||
}
|
||||
|
||||
defer epochClient.Cancel()
|
||||
|
||||
waitingDoneChan := make(chan struct{})
|
||||
cancelChan := make(chan struct{})
|
||||
|
||||
|
@ -321,6 +321,7 @@ func (u *utxoNursery) incubator(newBlockChan *chainntnfs.BlockEpochEvent,
|
||||
startingHeight uint32) {
|
||||
|
||||
defer u.wg.Done()
|
||||
defer newBlockChan.Cancel()
|
||||
|
||||
currentHeight := startingHeight
|
||||
out:
|
||||
|
Loading…
Reference in New Issue
Block a user