16
My application crashes with "too many open files" error. How can I increase the file descriptor limit?
Loading...
Q&A · Answered
My application crashes with "too many open files" error. How can I increase the file descriptor limit?
Accepted answer
# Check soft limit
ulimit -Sn
# Check hard limit
ulimit -Hn
# Check for specific process
cat /proc/PID/limits
ulimit -n 65535
# Edit /etc/security/limits.conf
* soft nofile 65535
* hard nofile 65535
root soft nofile 65535
root hard nofile 65535
# For systemd services, edit service file
[Service]
LimitNOFILE=65535Say what you tried, not only what worked — the next person needs the reasoning. Code goes in a fenced block.