How to fix "too many open files" error on Linux

Answered
Jan 05, 2026 1446 views 1 answers
16

My application crashes with "too many open files" error. How can I increase the file descriptor limit?

W
Platinum 285 rep

1 Answer

9

Check current limits

# Check soft limit
ulimit -Sn
# Check hard limit
ulimit -Hn
# Check for specific process
cat /proc/PID/limits

Increase limits temporarily

ulimit -n 65535

Increase limits permanently

# 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=65535
N
Answered by noor_code 1 week, 2 days ago
Gold 255 rep

Your Answer

You need to be logged in to answer questions.

Log In to Answer

Hot Questions

No hot questions available.