500s appear under load and logs show "accept4: too many open files" or "EMFILE".

IntermediateTroubleshooting5xx errors
Answer

Likely causes → The process hit its file descriptor limit (often the default 1024): too many sockets because of no connection reuse, leaked file handles, or a genuine traffic increase.

Diagnose →

cat /proc/$(pgrep -f myapp)/limits | grep 'open files'
ls /proc/$(pgrep -f myapp)/fd | wc -l
ss -s

Fix → Raise the limit (LimitNOFILE=65535 in the systemd unit, or the container runtime's ulimit), and fix leaks or missing connection pooling.

Prevent → Export process_open_fds / process_max_fds and alert at 80%.

All Real-World Interview questions Roadmap: Interview readiness

More on 5xx errors