I'm running an Icecast 2.4.3 server on a CentOS 7. When I have a lot of listeners, I receive these errors and everything stops working:
[2017-06-21 18:56:37] WARN connection/_accept_connection accept() failed with error 24: Too many open files
It's running on "ices" user:
sudo -u ices /opt/icecast/bin/icecast -c /opt/icecast/etc/icecast.xml -b
Or running as root with "changeowner" option to "ices" user.
I set limits.conf:
ices hard nofile 65536
ices soft nofile 65536
From ulimit:
[root@orfeu inweb]# su ices
[ices@orfeu inweb]$ ulimit -n
65536
But when I check the PID, I get:
tcp 0 0 <IP>:8000 0.0.0.0:* LISTEN 21650/icecast
[root@orfeu inweb]# cat /proc/21650/limits
Limit Soft Limit Hard Limit Units
...
Max open files 1024 4096 files
...
How can I fix this, to enforce 65536 file descriptors? Thank you.
Probably I found a solution. Need to check when the problem happens again.
I realize that limits.conf set the limits per user. I found out a way to set the limits per process.
/usr/bin/prlimit -n30000 -p `cat /var/run/icecast.pid`
Now I have:
Max open files 30000 30000 files
I don't know if there's a way to always start "icecast" binary with these limits, or always need to run the command against the PID after run.