Skip to content

Commit

Permalink
limit max number of sockets in poller. Fix #1962
Browse files Browse the repository at this point in the history
The number of FD in the poller is automatically configured
from the value of `ulimit -n`. On newer linux installations,
this limit is much higher by default. This can result in
unbound memory consumption.

There is already a mechanism in place to handle the case
when `ulimit -n == unlimited`. Extend it to support any
unreasonable big limit value.
  • Loading branch information
rcarpa authored and amadio committed Mar 21, 2023
1 parent 993e654 commit fecaf0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Xrd/XrdConfig.cc
Expand Up @@ -1187,7 +1187,7 @@ int XrdConfig::setFDL()

// Set the limit to the maximum allowed
//
if (rlim.rlim_max == RLIM_INFINITY) rlim.rlim_cur = maxFD;
if (rlim.rlim_max == RLIM_INFINITY || rlim.rlim_max > maxFD) rlim.rlim_cur = maxFD;
else rlim.rlim_cur = rlim.rlim_max;
#if (defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_5))
if (rlim.rlim_cur > OPEN_MAX) rlim.rlim_max = rlim.rlim_cur = OPEN_MAX;
Expand Down

0 comments on commit fecaf0b

Please sign in to comment.