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

explicitly close os.File to force release of file descriptor #97

Merged
merged 2 commits into from
Jun 8, 2020

Conversation

laser
Copy link
Contributor

@laser laser commented May 27, 2020

Fixes #94 .

Why does this PR exist?

Running GeneratePieceCommitment in a loop can occasionally produce (depending on the quantity of iterations) a too many open files error.

What's in this PR?

In Go, the file descriptor associated with an *os.File is cleaned up when the file is closed or when the *os.File is garbage collected. This changeset adds an explicit File#Close call instead of relying on garbage collection to free the file descriptor. When run in a loop, this keeps the file descriptor list at a constant size.

@laser laser changed the title Bugs/too many open files explicitly close os.File to force release of file descriptor May 27, 2020
Copy link
Contributor

@cryptonemo cryptonemo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@laser laser merged commit d168675 into master Jun 8, 2020
@laser laser deleted the bugs/too-many-open-files branch June 8, 2020 18:21
sbwtw pushed a commit to sbwtw/filecoin-ffi that referenced this pull request Jun 19, 2020
…n-project#97)

* fix: affirm that we don't run out of file descriptors

* be sure to close file instead of waiting for GC
gracenoah pushed a commit to gracenoah/filecoin-ffi that referenced this pull request Dec 20, 2020
…n-project#97)

* fix: affirm that we don't run out of file descriptors

* be sure to close file instead of waiting for GC
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.

"failed to build tree: failed to create data store: Too many open files" error when generating CommPs
2 participants