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

Set the soft ulimit value more conservatively (cherrypick of #11194) #11197

Merged
merged 1 commit into from Nov 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/rust/engine/fs/src/lib.rs
Expand Up @@ -782,14 +782,17 @@ pub fn increase_limits() -> Result<String, String> {
for more information.",
TARGET_NOFILE_LIMIT
);
// If we might be able to increase the limit, try to.
// If we might be able to increase the soft limit, try to.
if cur < max {
rlimit::Resource::NOFILE.set(max, max).map_err(|e| {
format!(
"Could not raise file handle limit above {}: `{}`. {}",
cur, e, err_suffix
)
})?;
let target_soft_limit = std::cmp::min(max, TARGET_NOFILE_LIMIT);
rlimit::Resource::NOFILE
.set(target_soft_limit, max)
.map_err(|e| {
format!(
"Could not raise soft file handle limit above {}: `{}`. {}",
cur, e, err_suffix
)
})?;
} else {
return Err(format!(
"File handle limit is capped to: {}. {}",
Expand Down