$RodHat_/search

$ man 2 getrlimit

Linux resource limits reference

Every process carries 16 soft and hard limits, and one of them being lower than anyone assumed is a common reason a service works on one box and not another. Each limit below has its own page with its resource number, the row it occupies in/proc/PID/limits, the bash ulimit flag, and what fails when you hit it.

The soft limit is what the kernel enforces. The hard limit is the ceiling an unprivileged process may raise its own soft limit to, and it can only be lowered, not raised, without privilege (details differ for RLIMIT_NOFILE, which is also capped by /proc/sys/fs/nr_open). Children inherit both across fork and execve, which is why a daemon started from a script keeps whatever the script set. Numbers come fromasm-generic/resource.h; behaviour followsgetrlimit(2). The BSDs have the same call with a different list; the FreeBSD per-jail answer is inthe rctl Tip.

What you saw, and which limit it points at

These are pointers, not diagnoses: ENOMEM and EAGAIN have other causes, including cgroup limits and system-wide exhaustion.

Read a /proc/PID/limits dump

Run cat /proc/PID/limits against the process that is misbehaving (not your login shell) and paste the output. Nothing leaves your browser.

Paste the file to see each limit with its soft and hard values.

16 limits

Files and descriptors

  • RLIMIT_FSIZEulimit -f · bytes

    Maximum size of a file the process may create or extend.

  • RLIMIT_COREulimit -c · bytes

    Maximum size of a core dump.

  • RLIMIT_NOFILEulimit -n · files

    One more than the highest file descriptor number the process may open.

Memory

  • RLIMIT_DATAulimit -d · bytes

    Maximum size of the data segment: initialized data, uninitialized data and the heap.

  • RLIMIT_STACKulimit -s · bytes

    Maximum size of the main thread stack.

  • RLIMIT_MEMLOCKulimit -l · bytes

    Maximum bytes the process may lock into RAM.

  • RLIMIT_ASulimit -v · bytes

    Maximum size of the process virtual address space.

Processes and signals

  • RLIMIT_NPROCulimit -u · processes

    Maximum number of processes and threads for the real user ID.

  • RLIMIT_SIGPENDINGulimit -i · signals

    Maximum number of signals that may be queued for the real user ID.

CPU time and scheduling

  • RLIMIT_CPUulimit -t · seconds

    Maximum CPU time the process may use.

  • RLIMIT_NICEulimit -e · priority (see note)

    Ceiling for how far the process may raise its own priority with nice or setpriority.

  • RLIMIT_RTPRIOulimit -r · priority

    Ceiling on the real-time priority the process may set with sched_setscheduler or sched_setparam.

  • RLIMIT_RTTIMEulimit -R · microseconds

    CPU time a real-time scheduled process may use without making a blocking system call.

Queues

  • RLIMIT_MSGQUEUEulimit -q · bytes

    Maximum bytes the real user ID may allocate to POSIX message queues.

Obsolete on Linux

  • RLIMIT_RSSulimit -m · bytes

    Resident set size limit. The kernel does not enforce it on modern Linux.

  • RLIMIT_LOCKSulimit -x · locks

    Limit on flock(2) locks and fcntl(2) leases. Early Linux 2.4 only.

Sources: getrlimit(2), proc_pid_limits(5), help ulimit in bash. Spot one that's wrong?Tell Rod.