Logs show `accept4(): Too many open files` and the service stops accepting connections.
BeginnerTroubleshootingSockets, ports, TIME_WAIT and conntrack
Answer
Likely causes → Every socket is a file descriptor. The process hit its RLIMIT_NOFILE (often 1024 soft by default), either through normal load or a socket/file leak.
Diagnose →
pid=$(pgrep -f myapp | head -1)
grep 'open files' /proc/$pid/limits
ls /proc/$pid/fd | wc -l
sudo lsof -p $pid | awk '{print $5}' | sort | uniq -c # IPv4/IPv6 vs REG files
cat /proc/sys/fs/file-nr # system-wide usage
Fix → Raise the limit where the process is started (systemd LimitNOFILE=65536, Docker --ulimit nofile=65536:65536, Kubernetes inherits from the runtime). If the count keeps climbing without load, look for a leak (see CLOSE_WAIT).
Prevent → Set explicit limits in unit files, and monitor FDs as a percentage of the limit.
More on Sockets, ports, TIME_WAIT and conntrack
`dmesg` is full of `nf_conntrack: nf_conntrack: table full, dropping packet` and new connections randomly time out.Intermediate`ss -s` on a reverse proxy shows 40,000 sockets in `TIME_WAIT`. Is that a problem?BeginnerAn app server's `CLOSE_WAIT` count grows steadily until the service logs `Too many open files`.Intermediate`dmesg` shows `TCP: request_sock_TCP: Possible SYN flooding on port 443. Sending cookies.`Intermediate`ss -ltn` shows the listener for port 8080 with `Recv-Q 129` and `Send-Q 128`, and clients hang on connect.AdvancedA blog post told you to set `net.ipv4.tcp_tw_recycle=1`, but `sysctl` returns `cannot stat /proc/sys/net/ipv4/tcp_tw_recycle`.Beginner