Fix goroutine lead in install action

a case in RunWithContex()
RunWithContex() {
go i.performInstall // running for a longer time
go i handleContex // return from ctx.Done() and send message to rchan, but performInstall is always running
result := < -rChan //read message
}

the message in rchan will be received in RunWithContex(), and RunWithContex() returns soon.
so, this case lead to goroutine performInstall leak

Signed-off-by: Jiahao Huang <july2993@gmail.com>
pull/11745/head
Jiahao Huang 3 years ago
parent 76157c6d06
commit cd18a713e2

@ -344,7 +344,7 @@ func (i *Install) RunWithContext(ctx context.Context, chrt *chart.Chart, vals ma
// not working. // not working.
return rel, err return rel, err
} }
rChan := make(chan resultMessage) rChan := make(chan resultMessage, 2)
doneChan := make(chan struct{}) doneChan := make(chan struct{})
defer close(doneChan) defer close(doneChan)
go i.performInstall(rChan, rel, toBeAdopted, resources) go i.performInstall(rChan, rel, toBeAdopted, resources)
@ -457,10 +457,10 @@ func (i *Install) failRelease(rel *release.Release, err error) (*release.Release
// //
// Roughly, this will return an error if name is // Roughly, this will return an error if name is
// //
// - empty // - empty
// - too long // - too long
// - already in use, and not deleted // - already in use, and not deleted
// - used by a deleted release, and i.Replace is false // - used by a deleted release, and i.Replace is false
func (i *Install) availableName() error { func (i *Install) availableName() error {
start := i.ReleaseName start := i.ReleaseName

Loading…
Cancel
Save