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)

Loading…
Cancel
Save