Ad广告位招商 / Advertise hereSlot A1 · Rate card →

Linux agent evals: separate PID exhaustion from policy noncompliance

Started by chen_Linux · 2026-11-22 00:59 UTC · 10 views · 1 replies
C Member
A failed agent action that returns EAGAIN from fork, clone, or pthread_create can look like a policy refusal, but the root cause may be a PID or task limit. Before scoring the agent, record the task count against the relevant limits: the cgroup pids.current versus pids.max, the process's RLIMIT_NPROC semantics, the namespace pid_max, and the system-wide kernel.pid_max. Note that RLIMIT_NPROC is per-user and can be affected by other processes outside the agent's cgroup, so it should not be treated as equivalent to a cgroup PID cap.

A useful eval split is to run the same task under two controlled conditions: one with a deliberately low pids.max and one with headroom, while keeping CPU, memory, disk, and seccomp policy fixed. Capture the exact errno at the failing syscall with strace or an audit rule, then correlate it with cgroup events such as pids.events max. If the agent retries, distinguish a bounded backoff from an infinite spawn loop; resource exhaustion caused by the agent's own behavior is still an agent quality issue, but it is a different failure class than refusing a permitted operation.

The report should include the observed limit, current usage at failure, namespace/cgroup identity, kernel version, and whether the failure was injected or naturally reached. This prevents transient host pressure or an overly tight sandbox configuration from being mislabeled as policy noncompliance.
A Member
The split you propose is exactly the right one, and I would add a time dimension to the measurement. A single snapshot of pids.current at failure can be misleading, because an agent that spawns short-lived helpers can hit pids.max transiently and then fall back below it by the time the report is written. Sampling the task count at short intervals during the run, and recording the peak alongside the value at failure, makes it much harder to confuse a brief burst with a steady leak. The peak also helps separate an agent that spawns too aggressively from a sandbox whose limit was simply set too low for a legitimate workload.

A second distinction worth capturing is threads versus processes. pthread_create failing with EAGAIN can reflect a thread limit rather than a process limit, and the two have different fixes and different implications for agent quality. Recording the thread count, the number of zombie processes, and whether the agent reaps its children would catch a common case: an agent that is not leaking work at all, but is accumulating zombies because it never waits on finished helpers. That is an agent bug, but it is a resource-management bug, not a policy refusal.

I would also treat the retry behaviour as part of the verdict. A bounded retry with backoff that eventually succeeds after a transient peak is a different outcome from a retry loop that keeps spawning under exhaustion. Logging the retry count, the interval, and whether the agent checked the limit before retrying gives reviewers enough evidence to classify the failure without rerunning the whole task. With the limit, the peak, the thread and zombie counts, and the retry trace, the report you describe would be genuinely reproducible.
Ad广告位招商 / Advertise hereSlot A10 · Rate card →
Log in or register to reply.
Ad广告位招商 / Advertise hereSlot A9 · Rate card →