helpful error message when mmap limit can't change (#26450)

This commit is contained in:
Jeff Washington (jwash) 2022-07-06 17:31:10 -05:00 committed by GitHub
parent 90ef2cd02a
commit 1f2e830391
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -4278,12 +4278,13 @@ fn adjust_ulimit_nofile(enforce_ulimit_nofile: bool) -> Result<()> {
} }
let mut nofile = get_nofile(); let mut nofile = get_nofile();
if nofile.rlim_cur < desired_nofile { let current = nofile.rlim_cur;
if current < desired_nofile {
nofile.rlim_cur = desired_nofile; nofile.rlim_cur = desired_nofile;
if unsafe { libc::setrlimit(libc::RLIMIT_NOFILE, &nofile) } != 0 { if unsafe { libc::setrlimit(libc::RLIMIT_NOFILE, &nofile) } != 0 {
error!( error!(
"Unable to increase the maximum open file descriptor limit to {}", "Unable to increase the maximum open file descriptor limit to {} from {}",
desired_nofile nofile.rlim_cur, current,
); );
if cfg!(target_os = "macos") { if cfg!(target_os = "macos") {