Skip to content

Bug 5554: Cap raw RLIMIT_NOFILE in max_filedescriptors default (#2483) - #2486

Open
squidadm wants to merge 1 commit into
squid-cache:v7from
squidadm:v7-backport-pr2483
Open

Bug 5554: Cap raw RLIMIT_NOFILE in max_filedescriptors default (#2483)#2486
squidadm wants to merge 1 commit into
squid-cache:v7from
squidadm:v7-backport-pr2483

Conversation

@squidadm

@squidadm squidadm commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

setMaxFD() updates Squid_MaxFD. Squid_MaxFD is then used to allocate
various FD-indexed tables, including Comm's fd_table. When
Config.max_filedescriptors is not set, Squid has to guess the maximum
number of descriptors this instance can handle. Prior to these changes,
that guess was based on OS-provided ulimits (RLIMIT_NOFILE).

Using raw RLIMIT_NOFILE values to set Squid_MaxFD results in huge
fd_table allocations that kill or incapacitate Squid when OS uses very
large limits (e.g., Kubernets soft limit of 1073741816=2^30-8
effectively means "unlimited" and results in ~432 MB fd_table). We now
cap such raw values at 100K which yields ~42 MB fd_table.

Several other old problems were discovered and marked during this work.
Those out-of-scope problems deserve dedicated fixes.

N.B. setMaxFD() calls setrlimit(2) in some cases, but the primary/final
setrlimit(2) call is in setSystemLimits(). That primary call sets the
soft limit to Squid_MaxFD.

…-cache#2483)

setMaxFD() updates Squid_MaxFD. Squid_MaxFD is then used to allocate
various FD-indexed tables, including Comm's `fd_table`. When
Config.max_filedescriptors is not set, Squid has to guess the maximum
number of descriptors this instance can handle. Prior to these changes,
that guess was based on OS-provided ulimits (RLIMIT_NOFILE).

Using raw RLIMIT_NOFILE values to set Squid_MaxFD results in huge
fd_table allocations that kill or incapacitate Squid when OS uses very
large limits (e.g., Kubernets soft limit of 1073741816=2^30-8
effectively means "unlimited" and results in ~432 MB fd_table). We now
cap such raw values at 100K which yields ~42 MB fd_table.

Several other old problems were discovered and marked during this work.
Those out-of-scope problems deserve dedicated fixes.

N.B. setMaxFD() calls setrlimit(2) in some cases, but the primary/final
setrlimit(2) call is in setSystemLimits(). That primary call sets the
soft limit to Squid_MaxFD.
@squid-anubis squid-anubis added the M-failed-description https://github.com/measurement-factory/anubis#pull-request-labels label Sep 1, 2026
@squid-anubis

Copy link
Copy Markdown
Collaborator

Cannot create a git commit message from PR title and description.

Error while parsing future commit message title: the line is too long 78>72

Problematic parser input:

Bug 5554: Cap raw RLIMIT_NOFILE in max_filedescriptors default (#2483) (#2486)

Please see PR title and description formatting requirements for more details.

This message was added by Anubis bot. Anubis will add a new message if the error text changes. Anubis will remove M-failed-description label when there are no corresponding failures to report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

M-failed-description https://github.com/measurement-factory/anubis#pull-request-labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants