Skip to content

Operator task guide

Self-hosted GPU runners for CI/CD: preflight and hygiene guide

Long-lived self-hosted GitHub Actions, Buildkite, or GitLab GPU runners fail intermittently when a prior timed-out CI job leaves zombie CUDA processes holding VRAM, stale container /dev/shm IPC files, full disk caches, or latent Xid hardware faults.

Run a fast deterministic preflight gate before every CI job checks out code: assert expected GPU count and healthy ECC state, terminate orphaned compute PIDs or recreate ephemeral containers, verify free /dev/shm and disk space, and auto-cordon unhealthy runners.

Reviewed . Reference guidance is not a diagnosis of your workload.

Step-by-step method

  1. 1

    Enforce isolated container lifecycle and /dev/shm sizing per CI job

    Avoid running bare-host pytest directly across sequential CI jobs. Launch each test run inside a fresh container (--ipc=host or explicit --shm-size=16g) so shared memory and CUDA contexts tear down cleanly when tests cancel or timeout.

    docker run --rm --gpus all --shm-size=16g \
      -v "$GITHUB_WORKSPACE:/work" -w /work \
      your-ci-image:cuda12.8 pytest tests/
  2. 2

    Run a 5-second GPU, VRAM, and Xid health preflight before scheduling tests

    Verify expected GPU count, zero stale compute processes occupying >100 MiB VRAM, zero newly retired/uncorrectable ECC pages, and adequate scratch NVMe headroom before starting expensive model tests.

    nvidia-smi --query-gpu=index,uuid,memory.used,ecc.errors.uncorrected.aggregate.total --format=csv,noheader
    nvidia-smi --query-compute-apps=pid,used_memory --format=csv,noheader
    df -h /var/lib/docker /tmp
  3. 3

    Quarantine flaky runners on critical Xids or persistent zombie allocations

    If a compute process fails to exit on SIGKILL (D-state kernel wedge after Xid 79, Xid 95, or Xid 143) or uncorrectable volatile ECC spikes, deregister the runner from CI automatically instead of retrying builds on a wedged host.

    dmesg -T | grep -E 'NVRM: Xid .*: (31|43|48|74|79|95|119|143)' | tail -n 10

Self-hosted GPU CI runner preflight actions

Signals, meanings and actions for self-hosted gpu runners for ci/cd: preflight and hygiene guide.
SignalWhat it meansNext action
Leftover python PID holding VRAM after canceled workflowOrphaned subprocess escaped job signal groupRun tests in isolated --init containers and reap leftover cgroup PIDs on preflight.
Bus error or unable to map shared memory mid DataLoader CI stepContainer defaulted to 64 MiB /dev/shmConfigure --shm-size=16g or /dev/shm tmpfs mount in runner template.
Disk pressure inside /var/lib/docker or Hugging Face cacheAccumulated multi-GB model weights and layersPrune stale HF cache & dangling Docker images on cron and verify free GiB in preflight.
Xid 79 / Xid 95 or process stuck in D-state during preflightNode requires host reboot / cold reset or RMA inspectionCordon runner immediately and capture host logs before rebooting.

Evidence checklist

  • Runner preflight output (GPU count, ECC totals, leftover compute-apps, df -h)
  • Container Docker flags (--gpus, --shm-size, --ipc)
  • Host dmesg Xid lines and runner systemd logs at failure time
  • Model weight cache eviction metrics

Common mistakes

Sharing one host Python virtualenv across concurrent or canceled CI jobs

Canceled GPU tests routinely orphan worker processes or leak CUDA IPC handles unless isolated in cgroup/container boundaries.

Keeping wedged GPU runners online after Xid 79/95/143

Every subsequent PR will randomly fail CI on the broken node until engineers stop trusting green/red signals.

Frequently asked questions

Why do PyTorch DataLoader CI tests fail with Bus error only on Docker runners?

Docker allocates only 64 MiB to /dev/shm by default. Multi-worker PyTorch DataLoader tensors quickly fill 64 MiB and crash with SIGBUS unless --shm-size or --ipc=host is configured.

How often should self-hosted GPU runners prune Hugging Face and Docker caches?

Set explicit cache size caps or run nightly cleanup when free disk drops below 20%, and inspect df -h in a pre-job health check before pulling large container layers or checkpoints.

Apply the method to your incident

Use the three free diagnoses to review your error and relevant evidence. Keep reference guidance separate from the cause and recovery status of your own workload.

Diagnose your incident