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

Tackle more fd leaks #1338

Merged
merged 2 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-more-fd-leaks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix fd leaks

There were some left over open file descriptors on simple.go.

https://github.com/cs3org/reva/pull/1338
1 change: 1 addition & 0 deletions pkg/rhttp/datatx/manager/simple/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (m *manager) Handler(fs storage.FS) (http.Handler, error) {
}
return
}
defer rc.Close()

_, err = io.Copy(w, rc)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/storage/fs/ocis/recycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func (fs *ocisfs) ListRecycle(ctx context.Context) (items []*provider.RecycleIte
}
return nil, errors.Wrap(err, "tree: error listing "+trashRoot)
}
defer f.Close()

names, err := f.Readdirnames(0)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/fs/ocis/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ func (t *Tree) Move(ctx context.Context, oldNode *Node, newNode *Node) (err erro

// ListFolder lists the content of a folder node
func (t *Tree) ListFolder(ctx context.Context, node *Node) ([]*Node, error) {

dir := t.lu.toInternalPath(node.ID)
f, err := os.Open(dir)
if err != nil {
Expand All @@ -209,6 +208,7 @@ func (t *Tree) ListFolder(ctx context.Context, node *Node) ([]*Node, error) {
}
return nil, errors.Wrap(err, "tree: error listing "+dir)
}
defer f.Close()

names, err := f.Readdirnames(0)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/storage/fs/ocis/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ func (upload *fileUpload) ConcatUploads(ctx context.Context, uploads []tusd.Uplo
if err != nil {
return err
}
defer src.Close()

if _, err := io.Copy(file, src); err != nil {
return err
Expand Down