The GPU Freeze That Was Out of Memory: Six Power Cycles and a Billion Open Files
My homelab's GPU worker is a gaming laptop with a GTX 1070, joined to a bare-metal Kubernetes cluster as a tainted node for media transcoding and local AI. On the day the NVIDIA device plugin went in, the very first smoke test, a pod running nvidia-smi, froze the whole laptop. It took six power cycles to find nothing, then one evening and a different method to find that the GPU had never been the problem: nvidia-smi was eating all 15 GiB of RAM in three seconds, because containerd gives every container a limit of a billion open files.
Impact
- Actual: six reproductions, each ending with the power button. The node is a worker, etcd lives elsewhere, so no data was lost; a forced power-off left the EFI partition dirty once.
- Blocked: every GPU workload and the media stack rollout, which requests the GPU, from the device-plugin rollout until the fix, the same evening.
- Misdiagnosis: for most of the day it was treated as a GPU or driver hang, and the test plan was built around the driver, the container toolkit and the kernel.
Timeline
- Afternoon - The device plugin is synced by Argo CD, the card is time-sliced into four shares, and a two-pod
nvidia-smismoke test freezes the node: the table header prints, then nothing. Ping answers, SSH times out during the banner, the node goesNotReady. - Afternoon - Six reproductions, one change per power cycle. The host runs the same command fine;
nvidia-smi -Lworks from the failing container; the device plugin's own container runs the full command fine. Ruled out: the plugin, time-slicing, persistence mode, capabilities, library versions, timing. Lockup and hung-task panics are armed, and netconsole streams kernel messages to my Mac. Neither reports anything. - Evening, first check - A test script now verifies the diagnostics before every test, and finds that netconsole had never delivered a single line: without a target MAC address it sends broadcast frames, which my router doesn't forward to the Mac on Wi-Fi. "No kernel trace" had meant nothing all day.
- Evening - Real workloads first: a CUDA sample and Jellyfin's ffmpeg (hardware encode and decode at ten times real time) both pass. Then a fresh pod with the device plugin's image runs the full
nvidia-smifine. The image matters. - Evening - A diff of the two containers shows MIG capability devices only in the working one; NVML turns out to create them itself. Pre-creating them in the failing image changes one thing: the query hangs as usual, but this time the node survives and the pod comes back
OOMKilled, with no memory limit set. - Evening - The kernel log:
nvidia-smiat 15.4 GB resident, 54 GB virtual, three seconds after it started. In a pod with a 1 GiB memory limit, the persistence-mode query alone gets killed; the same container withulimit -n 1024prints the full table. - Evening - A containerd drop-in caps the limit; new containers get 1024 / 524288, the original repro and the two-pod smoke test pass. Rolled out to the control plane too.
Root cause
- containerd 1.7's systemd unit sets
LimitNOFILE=infinity, so every container starts with the kernel's maximum: 1073741816 open files. - The full
nvidia-smitable includes persistence mode, which NVML gets fromnvidia-persistencedover a socket. That path allocates by the open-files limit: about 54 GB here. NVIDIA has acknowledged the bug innvidia-persistencedand suggests a lower hard limit until a fixed driver ships; a Debian bug report shows the same two huge maps right after the limit is read. nvidia-smi -Ldoesn't ask for persistence mode, and the device plugin's minimal image never took that path, which is why both worked.- The node has 15 GiB and no swap. The OOM killer usually lost the race against thrashing: the kernel stayed alive (ping), user space starved (SSH, kubelet), and with nothing stuck in the kernel, there was nothing to log. It looked exactly like a hardware hang.
Actions
- Fix:
LimitNOFILE=1024:524288in a containerd systemd drop-in, written by the containerd playbook with an assertion on the running service. Applied to both nodes; containerd'sKillMode=processkept running pods alive through the restart. - Verified: a new container shows soft 1024 / hard 524288; the original failing pod and the two-pod time-sliced test print the full table.
- Test kit kept: a script that checks netconsole actually arrives before each test, runs every GPU step under a watchdog that force-deletes the pod when the node stops answering, and pods for each hypothesis, including a memory-limited one.
- Next: memory limits on every GPU workload; consider swap or eviction thresholds on the GPU node; upgrade to containerd 2.x, which no longer sets the limit.
Lessons learned
- A diagnostic that reports nothing must be tested before its silence counts as evidence. One marker line through
/dev/kmsgwould have shown netconsole was broken on the first day. - Name the symptom, not the cause. "GPU freeze" came from where the output stopped. "The node stops answering SSH but answers ping" points at memory pressure as much as at hardware.
- Limit what you test. A memory limit on the first test pod would have turned a frozen node into an
OOMKilledpod in seconds, and the kernel log would have named the culprit. - Test real workloads first. CUDA and hardware encoding worked all along; knowing that early unblocked the media stack and narrowed the problem to one query.
- When each test costs a reboot, do the free comparisons first. Diffing two containers and reading the log after a non-fatal run found more than six power cycles did.
References
- NVIDIA Developer Forums: "Nvidia-smi uses all of ram and swap" - NVIDIA confirms the
nvidia-persistencedbug and the lower-hard-limit workaround; no fixed driver version named (last checked 2026-11). - Debian bug #1074032 - the same allocation seen with strace on Debian (last checked 2026-11).
- containerd 2.0 release notes - the explicit
LimitNOFILEremoved from the reference unit (last checked 2026-11). - containerd 1.7 Gives Containers a Billion-File Limit, So Code Sized by It Can Exhaust a Node's RAM - the mechanism and the fix, as a permanent note.
- Enable NVIDIA GPUs on a Bare-Metal Kubernetes Node - the setup procedure, now with the limit step.
- Homelab v2 Rebuild - the lab this happened in.