Discussion:
Bug#934208: Open file limits not set in systemd unit
(too old to reply)
Sammy Atmadja
2019-08-08 08:50:01 UTC
Permalink
Package: squid
Version: 4.6-1
Severity: normal
Tags: patch

/etc/init.d/squid increases the open file limit (ulimit -n 65535)
from the default value of 1024. This does not happen when squid
is started from systemd, resulting on busy systems in the
following errors in /var/log/squid/cache.log :

2019/08/08 09:59:19 kid1| WARNING! Your cache is running out of filedescriptors

Browsing is intermittently slow, or some pages fail to load.

This is easily fixed by the following patch, restoring the
pre-systemd behaviour:

--- /lib/systemd/system/squid.service 2019-02-19 06:29:20.000000000 +0100
+++ squid.service 2019-08-08 10:31:42.100000000 +0200
@@ -17,6 +17,7 @@
ExecStart=/usr/sbin/squid -sYC
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
+LimitNOFILE=65535

[Install]
WantedBy=multi-user.target


Sammy Atmadja

Disclaimer: https://www.transtrend.com/en/disclaimer/
Amos Jeffries
2019-08-12 11:10:02 UTC
Permalink
Post by Sammy Atmadja
/etc/init.d/squid increases the open file limit (ulimit -n 65535)
from the default value of 1024. This does not happen when squid
is started from systemd, resulting on busy systems in the
2019/08/08 09:59:19 kid1| WARNING! Your cache is running out of filedescriptors
These are not exactly equivalents.

The sysvinit default is to have a rather low FD limitation which
prevents squid.conf being able to set max_filedescriptors to useful
higher values. ulimit is used in that script as a workaround to raise
that limit higher - but it is still an explicit upper limit.

Under systemd the default is not to have any limitation at all. So
squid.conf can raise as high as the admin wants, _except_ when that
limit is set.

When there is a fixed upper limit Squid auto-detects and uses that.
Unfortunately there are still some bugs that needs to be straightened
out upstream for Squid to use the --with-filedescriptors value when
there is *no* specific upper limit provided by the OS.

The first of those fixes is in the pending 4.8 packages. Two more to
follow at a later date (no ETA sorry).

Amos

Loading...