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
Report a coding issue that possibly leaks memory due to unclosed resources #8914
Comments
subhamkrai
added a commit
to subhamkrai/rook
that referenced
this issue
Oct 5, 2021
Closing stdoutPipe that could possibly leaks memory due to unclosed resources. Closes: rook#8914 Signed-off-by: subhamkrai <srai@redhat.com>
10 tasks
subhamkrai
added a commit
to subhamkrai/rook
that referenced
this issue
Oct 5, 2021
Closing stdoutPipe that could possibly leaks memory due to unclosed resources. Closes: rook#8914 Signed-off-by: subhamkrai <srai@redhat.com>
subhamkrai
added a commit
to subhamkrai/rook
that referenced
this issue
Oct 5, 2021
Closing stdoutPipe that could possibly leaks memory due to unclosed resources. Closes: rook#8914 Signed-off-by: subhamkrai <srai@redhat.com>
subhamkrai
added a commit
to subhamkrai/rook
that referenced
this issue
Oct 5, 2021
Closing stdoutPipe for the discovery daemon that could possibly leaks memory due to unclosed resources. Closes: rook#8914 Signed-off-by: subhamkrai <srai@redhat.com>
leseb
pushed a commit
to subhamkrai/rook
that referenced
this issue
Oct 5, 2021
Closing stdoutPipe for the discovery daemon that could possibly leaks memory due to unclosed resources. Closes: rook#8914 Signed-off-by: subhamkrai <srai@redhat.com>
parth-gr
pushed a commit
to parth-gr/rook
that referenced
this issue
Feb 22, 2022
Closing stdoutPipe for the discovery daemon that could possibly leaks memory due to unclosed resources. Closes: rook#8914 Signed-off-by: subhamkrai <srai@redhat.com>
parth-gr
pushed a commit
to parth-gr/rook
that referenced
this issue
Feb 22, 2022
Closing stdoutPipe for the discovery daemon that could possibly leaks memory due to unclosed resources. Closes: rook#8914 Signed-off-by: subhamkrai <srai@redhat.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is this a bug report or feature request?
Deviation from expected behavior:
At https://github.com/rook/rook/blob/master/pkg/daemon/discover/discover.go#L156
rook/pkg/daemon/discover/discover.go
Line 156 in 078f648
Pipe
stdout
is opened and then used in the scanner, howeverstdout
is not closed after the usage, andcmd.Wait()
is not called.According to https://pkg.go.dev/os/exec#Cmd.StdoutPipe,
cmd.Wait()
will closed the pipe, but it is not invoked here.stdout
needs to be closed explicitly by invoking the closer, as demonstrated in:rook/tests/framework/utils/exec_utils.go
Line 70 in 078f648
Expected behavior:
While this may not be a real issue depending on the underlying logic and the concrete resource and memory consumption, it is cleaner and safer to explicitly close the pipe after the usage:
and/or terminate the
cmd
in the end by callingFound by static analyzer "DeepGo"
The text was updated successfully, but these errors were encountered: