IntermediateScenario
10 min

EMFILE: Too Many Open Files

LinuxLimitsReliability
Advertisement
Interview Question

A service starts failing with EMFILE errors. Describe how you identify the cause and fix it.

Key Points to Cover
  • Check ulimit/systemd limits and kernel fs.file-max
  • Use lsof to find FD leaks (sockets, files, inotify)
  • Audit connection pools and HTTP client reuse
  • Raise limits safely and patch leak in code
  • Add FD usage dashboards and alerts
Evaluation Rubric
Identifies FD pressure correctly30% weight
Finds source of FD leaks30% weight
Applies short/long-term fixes20% weight
Adds observability/limits20% weight
Hints
  • 💡In-flight HTTP clients may leak sockets.
Potential Follow-up Questions
  • How to tune systemd service limits?
  • What about ephemeral ports?
Advertisement