Closed Ongy closed 2 weeks ago
Hello,
Thank you for the PR, it is appreciated. But ultimately, I would prefer to let this setting outside of wstunnel. For me it is up to the system to configure the file descriptor limit. Either with systemd, ulimit, netconfig,...
In addition, this crate only works on linux/macos, so it should be gated by a conditonnal compilation cfg.
Or maybe make it the default without any flag for those os.
Hi, sorry for the late reply
While I fully agree that the hard limit should be set by the environment, the soft limit is mostly a historical issue with the 1024 FDs support by select(2)
. IMO it makes sense to up it in process when the application acknowledges that it can handle it.
Might even make sense without the flag :thinking:
Yea, gating to the OS makes sense. I'll have to figure out the syntax if that's the only issue.
I think we can make it the default without any flags and merge the PR. I checked the crate, and it does already nothing if it is a platform it does not support.
So calling everytime fdlimit::raise_fd_limit()
is fine for me as long as we dont exit if the call fails, and just log a warning.
Done.
Do you have a preference about squashing?
That's perfect, thank you. I am going to squash into 1 commit
This allows wstunnel to use fds>1024. Otherwise heavy use can easily run out of file descriptors on connection attempts. While there will still be a limit, it is significantly higher (~500 times on my system) which provides enough headroom for connections to be torn down and fds to be closed.