pkg
pkg copied to clipboard
fix: possible goroutine leak in exec
If timeout happens and ShouldWait is false (default) cmd.Wait() goroutine will stack forever on sending to done channel. The will be no receiver from done. Making the channel buffered lets the goroutine exit.
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities
0 Security Hotspots
0 Code Smells
No Coverage information
0.0% Duplication
In the old version of the package:
oroutine 1482 [chan send, 47 minutes]:
github.com/argoproj/pkg/exec.RunCommandExt.func1()
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x3f
created by github.com/argoproj/pkg/exec.RunCommandExt
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x43f
goroutine 2141 [chan send, 20 minutes]:
github.com/argoproj/pkg/exec.RunCommandExt.func1()
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x3f
created by github.com/argoproj/pkg/exec.RunCommandExt
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x43f
goroutine 1924 [chan send, 29 minutes]:
github.com/argoproj/pkg/exec.RunCommandExt.func1()
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x3f
created by github.com/argoproj/pkg/exec.RunCommandExt
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x43f
goroutine 1379 [chan send, 51 minutes]:
github.com/argoproj/pkg/exec.RunCommandExt.func1()
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x3f
created by github.com/argoproj/pkg/exec.RunCommandExt
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x43f
goroutine 1921 [chan send, 29 minutes]:
github.com/argoproj/pkg/exec.RunCommandExt.func1()
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x3f
created by github.com/argoproj/pkg/exec.RunCommandExt
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x43f
goroutine 1432 [chan send, 49 minutes]:
github.com/argoproj/pkg/exec.RunCommandExt.func1()
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x3f
created by github.com/argoproj/pkg/exec.RunCommandExt
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x43f
goroutine 2341 [chan send, 12 minutes]:
github.com/argoproj/pkg/exec.RunCommandExt.func1()
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x3f
created by github.com/argoproj/pkg/exec.RunCommandExt
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x43f
goroutine 1369 [chan send, 51 minutes]:
github.com/argoproj/pkg/exec.RunCommandExt.func1()
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x3f
created by github.com/argoproj/pkg/exec.RunCommandExt
/go/pkg/mod/github.com/argoproj/[email protected]/exec/exec.go:94 +0x43f
But the bug is relevant for the latest version too