containerd 1.7 Gives Containers a Billion-File Limit, So Code Sized by It Can Exhaust a Node's RAM
A process inherits its open-files limit (RLIMIT_NOFILE) from its parent, and containers are no exception: a container's processes start with the limits of the containerd service that launched them. containerd 1.7's systemd unit sets LimitNOFILE=infinity, which systemd turns into the kernel's fs.nr_open, 1073741816. So every container on such a node starts with a limit of about a billion file descriptors, soft and hard.
Most programs never notice: the limit is a ceiling, not an allocation. The trouble starts with code that sizes a table by the limit, one slot per possible descriptor. With the usual 1024 that's a few kilobytes; with a billion it's tens of gigabytes, allocated in seconds.
What It Looks Like
On my GPU node (15 GiB RAM, no swap, as Kubernetes nodes usually run), the full nvidia-smi inside a Debian container connected to nvidia-persistenced for the persistence-mode column, read the open-files limit, and mapped about 54 GB. The kernel didn't kill it in time. The node thrashed instead:
- ping still answered (the kernel was fine), SSH timed out during the banner, the kubelet stopped reporting and the node went
NotReady; - no kernel trace at all: nothing was stuck or spinning in the kernel, so lockup and hung-task detectors had nothing to report;
- the output stopped right after the table header, which made it look like a GPU hang.
nvidia-smi -L never touched that path, and the same command on the host ran with the host's usual limits. NVIDIA has acknowledged the nvidia-persistenced side of the bug and suggests a lower hard limit (524288) until a fixed driver ships.
The Fix
Give containerd the same limits as any other service, with a systemd drop-in, then restart it:
# /etc/systemd/system/containerd.service.d/10-limitnofile.conf
[Service]
LimitNOFILE=1024:524288
- Soft 1024, hard 524288: programs that need more descriptors raise their own soft limit up to the hard one, as Go programs do automatically.
- Running containers keep their old limit until they're recreated; containerd's unit uses
KillMode=process, so the restart doesn't stop them. - containerd 2.x removed the explicit
LimitNOFILEfrom its unit, so containers get systemd's defaults. - Check from a new container:
ulimit -Sn; ulimit -Hn.
Related
- kubelet Depends on containerd Through the CRI Socket - containerd is the parent of everything a pod runs.
- Debian's containerd Package Ships a Config Stub Without SystemdCgroup - another Debian containerd default worth checking.
- Time-Slicing Lets Pods Share a GPU but Not Isolate Its Memory - the GPU sharing this was found while testing.
- Homelab v2 Rebuild - where it happened (2026-11-25).
References
- NVIDIA Developer Forums: "Nvidia-smi uses all of ram and swap" - NVIDIA's confirmation that the cause is in
nvidia-persistenced, and the workaround (a lower hard limit, 524288 or 16777216). No fixed driver version named (last checked 2026-11). - Debian bug #1074032: "nvidia-smi locks up machine with new file descriptor limit" - the strace:
prlimit64returns ~1 billion, then ~4 GB and ~51 GB anonymous maps after connecting tonvidia-persistenced(last checked 2026-11). - containerd 2.0 release notes - the explicit
LimitNOFILEremoved from the referencecontainerd.service(last checked 2026-11). - Arch Linux bug FS#77548 - the same
LimitNOFILE=infinitymaking other containers consume all memory: the pattern isn't specific to NVIDIA. homelab/docs/postmortems/2026-11-25-gpu-node-oom.md- the full incident, with timeline and evidence.
Review cards
Flashcard Why does a container on a containerd 1.7 node start with an open-files limit of about a billion?
Containers inherit containerd's limits, and its systemd unit sets LimitNOFILE=infinity, which systemd turns into the kernel's fs.nr_open (1073741816).
Flashcard How can a high open-files limit use up a node's RAM when no file is opened?
Some code allocates a table with one slot per possible descriptor, sized from the limit. At a billion descriptors that's tens of gigabytes, allocated at once.
Quiz A node answers ping, SSH times out at the banner, and no kernel trace or lockup panic appears. Which cause fits best?
- A GPU stuck on the PCIe bus with the CPUs spinning in the driver
- Memory exhaustion without swap: user space thrashes while the kernel still runs
- A kernel panic that rebooted the node
A spinning kernel would trip the lockup detector; a panic would reboot. Thrashing leaves the kernel alive and user space starved, with nothing to log.
Flashcard What does the containerd drop-in `LimitNOFILE=1024:524288` change, and for which containers?
Soft limit 1024 and hard limit 524288, like other services. Only containers created after containerd restarts get it; running ones keep the old limit until recreated.