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:
2 files changed
+3
No files matched your search
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user