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

When using filestore as the storage backend, why are chunk files not closed during the merging phase? #1238

Open
nervtech opened this issue Jan 15, 2025 · 1 comment
Labels

Comments

@nervtech
Copy link

Hi,

I was reviewing the code and noticed that in the file merge process, the file opened with os.Open is not explicitly closed.

for _, partialUpload := range uploads {
fileUpload := partialUpload.(*fileUpload)
src, err := os.Open(fileUpload.binPath)
if err != nil {
return err
}
if _, err := io.Copy(file, src); err != nil {
return err
}
}

From my understanding, not closing the file could lead to resource leaks, especially with file descriptors.

Is there a specific reason why src.Close() is omitted here?

@Acconut
Copy link
Member

Acconut commented Jan 15, 2025

Thank you for pointing this out! You are right that this function is missing calls to src.Close. This seems to be a mistake in my eyes and not serving any purpose. Would you be interested in opening a PR to fix this?

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

No branches or pull requests

2 participants