﻿# Distinguish a real-user process limit from a service task budget

Read RLIMIT_NPROC against the real-user task population and distinguish it from per-service cgroup enforcement.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-linux-nproc-real-uid/
Language: en

A tokenizer service fails to create a child even though its own cgroup has task headroom. Another service uses the same real user identity. RLIMIT_NPROC is associated with the calling process's real user population on Linux, so a per-service process count can miss the shared condition that prevents the next fork.

## Read the failing identity

Record the worker's real UID, effective limits and failed operation. The real user identity is the relevant boundary for this limit, not merely the service name or effective user displayed by a convenient summary. Linux also counts threads for this purpose. A deployment that shares one account among several services can therefore couple their task-creation headroom unexpectedly.

## Distinguish the inherited threshold

The resource limit is inherited by the process and shared across its threads. Different processes using the same real UID can carry different thresholds while seeing the shared user population. Inspect the actual failing process rather than treating a user's interactive shell setting as a global account configuration. Preserve relevant privilege exceptions when explaining whether enforcement applies.

## Compare the cgroup boundary

Per-cgroup pids constraints and a service task budget have a different scope. A service can be below its own task allowance while the real-user population is already too large for its RLIMIT_NPROC. Conversely, a cgroup can reject creation before that user threshold is reached. EAGAIN alone does not select among these causes; fork documents additional system task constraints as well.

## Review shared-account growth

Count authorized tasks across the affected real UID, grouped by their actual service ownership. Include library threads and leftover children rather than counting process leaders only. Do not terminate unrelated work to make a test pass. First identify whether a new service, duplicated worker tree or unintended thread growth consumed the population on which the failed operation depends.

## Test scope without changing production

In an isolated account fixture, compare task creation with sibling work present and absent while keeping the tested process's inherited threshold constant. Verify the specific failure and competing cgroup event evidence. Acceptance explains the limit's scope; it does not justify unlimited task creation, eliminate host memory constraints or establish a safe worker count for every model and tokenizer implementation.

## Primary references

[Linux getrlimit](https://man7.org/linux/man-pages/man2/getrlimit.2.html).

[Linux fork](https://man7.org/linux/man-pages/man2/fork.2.html).

[systemd Execution Environment](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html).

Related reading: [Cannot create thread in a container: checking pids.max and pids.events](/journal/container-pids-limit-thread-errors/); [Idle GPU, throttled CPU: diagnosing container CPU quota](/journal/cgroup-cpu-throttling-gpu-feeder/).
