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

File descriptor leak when hash/log files are corrupt or not matching #46

Closed
seizethedave opened this issue Oct 1, 2022 · 1 comment · Fixed by #47
Closed

File descriptor leak when hash/log files are corrupt or not matching #46

seizethedave opened this issue Oct 1, 2022 · 1 comment · Fixed by #47

Comments

@seizethedave
Copy link

In our case we had hash/log files that were not corrupt but had different file_identifier fields due to problems in a writing pipeline. The result is sparkey_hash_open() will (correctly) return -305 (SPARKEY_FILE_IDENTIFIER_MISMATCH), but the log resources will not be cleaned up, because:

  • in sparkey_hash_open, reader->open_status is not set when there's a file identifier mismatch (ditto any of the checks sparkey_hash_open does)
  • sparkey_hash_close does nothing if reader->open_status is not set

The fallout is munmap and close are not called on the log file, leading to leaking file descriptors and the OS refusing to remove those bytes from the filesystem until the process is killed.

I intend to fix this problem, but figured I'd document it first!

@spkrka
Copy link
Member

spkrka commented Oct 3, 2022

Thanks for the report! Since you intend to fix it, I will wait for the PR to review.

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.

2 participants