Diagnosing File Descriptor Exhaustion: EMFILE and ENFILE on Unix
A diagnostic guide for Unix EMFILE and ENFILE errors: how to tell per-process exhaustion from system-wide limits, inspect open descriptors, and apply targeted fixes.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
A diagnostic guide for Unix EMFILE and ENFILE errors: how to tell per-process exhaustion from system-wide limits, inspect open descriptors, and apply targeted fixes.
Create a systemd drop-in override with LimitNOFILE=65535, reload the manager, and restart the unit to raise the soft and hard RLIMIT_NOFILE for a service process.
Unix fork-exec preserves file descriptors by design, which can lead to security leaks. Learn how to use FD_CLOEXEC and strace to manage descriptor inheritance and prevent resource leakage.
File descriptors are the kernel’s integer handles for open resources. This post explains how they work, why close-on-exec prevents leaks, how to inspect them via /proc, and how to pass them between processes.