mirror of
https://github.com/helm/helm.git
synced 2026-06-30 19:57:48 +00:00
Fix goroutine leak in action install
During the install process there was a place where an install process could be stuck trying to write to a channel. This would happen when a context had completed prior to performInstall finishing. In a short running Helm Client this was not a problem. But, for long running applications that use Helm as an SDK there are problems where a memory leak ends up happening due to goroutines never being able to complete. This fix provides a means for performInstall to write to its channel using the method already used to fix the upgrade issue of the same kind. Fixes #11805 Signed-off-by: Matt Farina <matt.farina@suse.com>
This commit is contained in:
@@ -369,13 +369,17 @@ func (i *Install) RunWithContext(ctx context.Context, chrt *chart.Chart, vals ma
|
||||
return rel, err
|
||||
}
|
||||
rChan := make(chan resultMessage)
|
||||
ctxChan := make(chan resultMessage)
|
||||
doneChan := make(chan struct{})
|
||||
defer close(doneChan)
|
||||
go i.performInstall(rChan, rel, toBeAdopted, resources)
|
||||
go i.handleContext(ctx, rChan, doneChan, rel)
|
||||
result := <-rChan
|
||||
//start preformInstall go routine
|
||||
return result.r, result.e
|
||||
go i.handleContext(ctx, ctxChan, doneChan, rel)
|
||||
select {
|
||||
case result := <-rChan:
|
||||
return result.r, result.e
|
||||
case result := <-ctxChan:
|
||||
return result.r, result.e
|
||||
}
|
||||
}
|
||||
|
||||
func (i *Install) performInstall(c chan<- resultMessage, rel *release.Release, toBeAdopted kube.ResourceList, resources kube.ResourceList) {
|
||||
|
||||
Reference in New Issue
Block a user