Errors such as Too many open files, failed process creation, and unexpectedly small core dumps often come from per-process resource limits. Check the live process first. The limit in your login shell may not match the limit inherited by a service hours earlier.
Read a running process
pid=12345
cat "/proc/$pid/limits"The table lists each resource with its soft limit, hard limit, and units. /proc/PID/limits reflects the selected process rather than the shell running the diagnostic command.3
With util-linux prlimit:
prlimit --pid "$pid"
prlimit --pid "$pid" --nofile --nproc --coreprlimit can read or change limits for a process, subject to permissions. Supplying a PID without new values is the inspection path.1
Understand soft and hard limits
The soft limit is the value enforced by the kernel. A process may lower it and may raise it up to the hard limit. Raising the hard limit requires appropriate privilege. Children inherit resource limits across fork, and limits are preserved across execve.2
This inheritance explains why changing ulimit in your current shell does not repair an already running daemon.
Compare launch contexts
For the current shell:
ulimit -Sn
ulimit -HnFor a systemd service:
systemctl show example.service \
-p MainPID \
-p LimitNOFILE \
-p LimitNPROC \
-p LimitCOREThen compare those properties with /proc/MainPID/limits. Wrapper processes, container runtimes, PAM configuration, and service-manager defaults can all contribute to the inherited value.
Reproduce a limit in one child
prlimit --nofile=64:64 -- sh -c '
printf "soft="; ulimit -Sn
printf "hard="; ulimit -Hn
'The limit applies to the new child and disappears when it exits. This is useful for testing application error handling without changing your login shell or a live service.1
A high open-file limit does not explain current descriptor use. Count /proc/PID/fd separately and identify whether descriptors are sockets, files, pipes, or anonymous kernel objects.
[!CAUTION] Changing limits on a live process can alter failure behavior immediately. Raising a limit may also move pressure to memory, ports, kernel tables, or downstream services. Fix the leak or capacity model rather than treating a larger number as the root cause.