Error Codes Wiki

Linux Error EMFILE (errno 24) — Too Many Open Files Fix

Criticallinux errno

Overview

Linux errno 24 EMFILE means the process has reached its open file descriptor limit.

Key Details

  • Error: EMFILE (errno 24)
  • Message: Too many open files
  • Process file descriptor limit reached
  • Common in high-traffic servers

Common Causes

  • Application not closing file handles
  • Default ulimit too low (often 1024)
  • Socket connections counted as file descriptors
  • File descriptor leak in application code

Steps

  1. 1Check current limit: ulimit -n
  2. 2Increase limit: ulimit -n 65536
  3. 3Permanent fix: edit /etc/security/limits.conf
  4. 4Find open files: lsof -p PID | wc -l
  5. 5Fix application file descriptor leaks

Tags

linuxlinux-errnolinux errno 24ubuntuterminal

More in Linux Errno

Frequently Asked Questions

Default is often 1024. Production servers should set 65536+.