Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: possible goroutine leak in exec #451

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

noxiouz
Copy link

@noxiouz noxiouz commented Jul 8, 2023

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.

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.

Signed-off-by: Anton Tiurin <[email protected]>
@noxiouz noxiouz force-pushed the fix_goroutine_leak branch from 57d950d to 74a379b Compare July 11, 2023 10:30
@sonarcloud
Copy link

sonarcloud bot commented Jul 11, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@noxiouz
Copy link
Author

noxiouz commented Jul 13, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant