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

Add best-effort limits on async file opens to reduce file handle counts (Cherry-pick of #20055) #20078

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

WorkerPants
Copy link
Member

As described in #19765, 2.17.x uses more file handles than previous versions. Based on the location of the reported error, I suspect that this is due to the move from using the LMDB store for all files, to using the filesystem-based store for large files (#18153).

In particular: rather than digesting files inside of spawn_blocking while capturing them into the LMDB store (imposing the limit of blocking threads from the tokio runtime), fn store moved to digesting them using tokio's async file APIs, which impose no such limit.

This change adds a semaphore to (some) file opens to provide a best-effort limit on files opened for the purposes of being captured. It additionally (in the first commit) fixes an extraneous file handle that was being kept open during capture.

Fixes #19765.

…ts (#20055)

As described in #19765, `2.17.x` uses more file handles than previous
versions. Based on the location of the reported error, I suspect that
this is due to the move from using the LMDB store for all files, to
using the filesystem-based store for large files (#18153).

In particular: rather than digesting files inside of `spawn_blocking`
while capturing them into the LMDB store (imposing the [limit of
blocking
threads](https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html#method.max_blocking_threads)
from the tokio runtime), `fn store` moved to digesting them using
tokio's async file APIs, which impose no such limit.

This change adds a semaphore to (some) file opens to provide a
best-effort limit on files opened for the purposes of being captured. It
additionally (in the first commit) fixes an extraneous file handle that
was being kept open during capture.

Fixes #19765.
@WorkerPants WorkerPants added this to the 2.17.x milestone Oct 24, 2023
@WorkerPants WorkerPants added the category:bugfix Bug fixes for released features label Oct 24, 2023
@WorkerPants WorkerPants requested review from huonw and stuhood October 24, 2023 04:14
@huonw huonw merged commit 19d8afa into 2.17.x Oct 24, 2023
@huonw huonw deleted the cherry-pick-20055-to-2.17.x branch October 24, 2023 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:bugfix Bug fixes for released features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants