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

Files are opened but never closed #471

Closed
dholbach opened this issue Oct 27, 2021 · 1 comment
Closed

Files are opened but never closed #471

dholbach opened this issue Oct 27, 2021 · 1 comment
Assignees

Comments

@dholbach
Copy link
Member

From Ada Logics

There are two occurrences in Helmchart controller where a file is opened but never closed here and here. This can lead to resource leaks and exhaustion of available file descriptors in the process. An example of the code pattern is shown here:

indexFile, err :=
os.Open(r.Storage.LocalPath(*repository.GetArtifact()))
if err != nil {
     return sourcev1.HelmChartNotReady(chart,
sourcev1.StorageOperationFailedReason, err.Error()), err
}
b, err := io.ReadAll(indexFile)

Recommendation

Fix the file descriptor leak by appropriately closing opened files. This can be performed with a deferred indexFile.Close() operation

@makkes
Copy link
Member

makkes commented Dec 3, 2021

I believe this is already addressed in #485

@dholbach dholbach closed this as completed Dec 3, 2021
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 a pull request may close this issue.

3 participants