Linux file descriptor limits and socket leaks: checking and tuning ulimit and file-max
The article explains how Linux caps file descriptors at two levels: per-process soft and hard limits set via ulimit and limits.conf, and a system-wide ceiling stored in /proc/sys/fs/file-max. It shows commands to inspect these limits and to count a running process's open descriptors, which helps reveal socket leaks. A small Go program is used to demonstrate a leak and compare it against a clean version that closes connections properly. The piece also presents cleanup patterns in Go, Java, and Python, along with ways to raise the limit permanently through limits.conf, systemd service files, or at application startup.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in