Unclear TcpStream error in macOS about file limits

Did you mean in Github? OK no problem.

By the way , I use std::process::command to set ulimit but it's not work.

fn main(){
use std::process::{Command};

let child = Command::new("ulimit")
    .arg("-n")
    .arg("128")
    .arg("-a")
    .spawn()
    .expect("failed to execute child");

child
    .wait_with_output()
    .expect("failed to wait on child");

}

The arg("128") does not change ulimit -n .
I know it could be set in shell session but i want to set in rust. Is there any way to do this?

ulimit is a shell-builtin in Zsh, at least in Linux.
Just use ulimit -n 16 as a shell command in the report, I don't think it is bad at all.

I investigated the problems a bit: it seems like that the implementation of
getaddrinfo in macOS is weird. It doesn't report EMFILE when reaching open-file limits.
Instead it reports EAI_NONAME which is confusing.

We could special-case for EAI_NONAME with the check for RLIMIT_NOFILE,
however it seems complicated for this stress-test only.


One could go to my repo for the investigation vi CI: https://github.com/lzutao/rust-error-file-limits

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.