Builds and cron jobs on a server start failing with "fork: retry: Resource temporarily unavailable" while memory and CPU are fine.
IntermediateTroubleshootingDisk, memory and CPU
Answer
Likely causes → The process or thread limit was reached: the user's ulimit -u, systemd's TasksMax for the service, the container's pids.max, or the global kernel.pid_max. A thread leak or a fork bomb in a script is usually behind it.
Diagnose →
ps -eLf | wc -l # total threads
ps -eLf | awk '{print $1}' | sort | uniq -c | sort -nr | head
ulimit -u
systemctl show myapp -p TasksMax -p TasksCurrent
cat /sys/fs/cgroup/pids.max /sys/fs/cgroup/pids.current 2>/dev/null
Fix → Kill the leaking process, then raise the limit if the workload genuinely needs more (TasksMax=8192 in the unit, LimitNPROC or /etc/security/limits.d/). Fix the thread leak in the app.
Prevent → Set sensible PID limits per container (kubelet podPidsLimit) so one bad pod can't exhaust the node, and alert on thread count growth.
More on Disk, memory and CPU
The app fails to write with "No space left on device", but `df -h` shows the volume is only 40% used.Beginner`df -h` says `/` is 100% full, but `du -sh /*` only adds up to 30% of the disk.BeginnerA server shows load average 40 on 8 cores, but `top` shows CPU 60% idle and the app is crawling.BeginnerPods are being evicted with "The node was low on resource: ephemeral-storage. Container app was using 18Gi, which exceeds its request of 0."IntermediateCI build agents running Docker fail with "no space left on device" while pulling images; `/var/lib/docker` is 95% full.IntermediatePostgres on a VM died overnight; `dmesg` shows "Out of memory: Killed process 2314 (postgres) total-vm:..., anon-rss:...".Intermediate