James White asked:
I’m running Squid 3.3 (EPEL) on CentOS 7 and recently I have been getting the following error message in my
WARNING! Your cache is running out of filedescriptors
I am slightly confused by this because I seem to have ample descriptors available:
squidclient mgr:info | grep 'file descri' Maximum number of file descriptors: 16384 Available number of file descriptors: 16326 Reserved number of file descriptors: 100
Squid was also compiled with this flag:
Squid confirms that these are actually available on startup:
2015/08/18 21:11:45 kid1| With 16384 file descriptors available
However this error keeps occurring. Not long after this error is logged the
squid process seems to also hit 100% CPU or use nearly all of the system memory up over 90%, causing the internet speed to drop to a crawl or just hang indefinitely. Killing the process and restarting resolves it but eventually it will happen again.
I have a total of 8 GB of memory available, these are the memory/cache related parameters in my
cache_dir ufs /var/spool/squid 16000 16 256 cache_mem 1024 MB
I am also using
ufdbguard and additional helper plugins for Kerberos and NTLM authentication.
The number of file descriptors is set in the systemd unit file. By default this is 16384, as you can see in
To override this, create a locally overriding
/etc/systemd/system/squid.service which changes the amount of file descriptors. It should look something like this:
.include /usr/lib/systemd/system/squid.service [Service] LimitNOFILE=65536
Do not edit the default file
/usr/lib/systemd/system/squid.service, as it will be restored whenever the package is updated. That is why we put it in a local file to override defaults.
After creating this file, tell systemd about it:
and then restart squid.
systemctl restart squid
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.