Skip to content

SDK 3.9.4: Goroutine leak in reportToRun  #11805

Description

@Segflow

In helm.sh/helm/v3 v3.9.4 the method reportToRun is implemented as follow:

func (i *Install) reportToRun(c chan<- resultMessage, rel *release.Release, err error) {
	i.Lock.Lock()
	if err != nil {
		rel, err = i.failRelease(rel, err)
	}
	c <- resultMessage{r: rel, e: err}
	i.Lock.Unlock()
}

I have confirmed that after performing an install action (using RunWithContext) leads to goroutine leak.

image

The above screenshot shows that goroutines are stuck in reportToRun. Here a sample stack trace of one of those routines:

goroutine 15463 [chan send, 32 minutes]:
helm.sh/helm/v3/pkg/action.(*Install).reportToRun(0xc0026086e0, 0xc0026804c0?, 0x3?, {0x22dd9c0?, 0xc006a7bf20?})
	/go/pkg/mod/helm.sh/helm/[email protected]/pkg/action/install.go:435 +0xd6
helm.sh/helm/v3/pkg/action.(*Install).performInstall(0xc0026086e0, 0xc005269f60?, 0xc005216310, {0x0?, 0x0?, 0x0?}, {0xc0026804c0, 0x3, 0x4})
	/go/pkg/mod/helm.sh/helm/[email protected]/pkg/action/install.go:389 +0x2ea
created by helm.sh/helm/v3/pkg/action.(*Install).RunWithContext
	/go/pkg/mod/helm.sh/helm/[email protected]/pkg/action/install.go:349 +0x128a

The block seems to be in the chan send call.

On another note, I believe if we fall into the error path, the i.Lock will stay locked forever.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugCategorizes issue or PR as related to a bug.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions