Skip to content

Operator task guide

How to debug SGLang Docker, multi-node serving, OOM, and NCCL errors

SGLang separates RadixAttention prefix cache budgeting (--mem-fraction-static) from Tensor Parallel worker communication over ZMQ and NCCL. Startup OOMs typically mean weights plus static KV pool exceeded available GPU headroom or another process already occupies VRAM.

For multi-node inference across Docker or Kubernetes, pin identical lmsysorg/sglang Docker tags, mount large /dev/shm (--shm-size=16g or --ipc=host), pass matching --dist-init-addr and --node-rank flags, and enable --enable-metrics for Prometheus visibility.

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

Step-by-step method

  1. 1

    Verify SGLang Docker runtime, /dev/shm, and free GPU VRAM

    Confirm the container sees all expected NVIDIA GPUs, has ample /dev/shm for NCCL/IPC, and is not sharing GPUs with leftover worker processes.

    docker run --gpus all --shm-size=16g --rm lmsysorg/sglang:latest nvidia-smi
    df -h /dev/shm
  2. 2

    Tune --mem-fraction-static for SGLang CUDA OOM

    If SGLang fails with torch.OutOfMemoryError during RadixCache allocation or forward passes, inspect free VRAM vs --mem-fraction-static (default typically ~0.88) and test lowering --mem-fraction-static to 0.78 to 0.85 or capping --max-running-requests.

    python3 -m sglang.launch_server \
      --model-path YOUR_MODEL \
      --tp 4 \
      --mem-fraction-static 0.82 \
      --enable-metrics
  3. 3

    Configure multi-node SGLang with explicit dist-init-addr and NIC bindings

    On multi-node deployments, ensure node 0 and worker nodes agree on --dist-init-addr, --nnodes, --node-rank, and NCCL_SOCKET_IFNAME, and verify port reachability before launch.

    # Node 0
    NCCL_SOCKET_IFNAME=eth0 python3 -m sglang.launch_server --model-path YOUR_MODEL --tp 16 --nnodes 2 --node-rank 0 --dist-init-addr 10.0.0.10:20000
    # Node 1
    NCCL_SOCKET_IFNAME=eth0 python3 -m sglang.launch_server --model-path YOUR_MODEL --tp 16 --nnodes 2 --node-rank 1 --dist-init-addr 10.0.0.10:20000
  4. 4

    Debug SGLang NCCL timeouts and FlashInfer kernel faults

    When requests stall or return worker timeouts, run a diagnostic pass with NCCL_DEBUG=INFO and inspect whether a single rank hit a FlashInfer illegal memory access, host OOM kill, or P2P hang.

    NCCL_DEBUG=INFO dmesg -T | grep -iE 'Killed process|NVRM: Xid'

SGLang failure signal to action

Signals, meanings and actions for how to debug sglang docker, multi-node serving, oom, and nccl errors.
SignalWhat it meansNext action
torch.OutOfMemoryError during SGLang startup or batch executionStatic RadixCache fraction or activation peak exceeded free VRAM.Check nvidia-smi for competing processes, lower --mem-fraction-static, or cap --max-running-requests.
SGLang NCCL error or timeout during TP/multi-node initMismatched --dist-init-addr, small /dev/shm, or broken PCIe P2P.Verify port 20000 reachability, raise --shm-size, and test NCCL_DEBUG=INFO.
python not found or wrong interpreter in containerContainer PATH differs from entrypoint python3.Invoke python3 -m sglang.launch_server explicitly inside lmsysorg/sglang image.
FlashInfer illegal memory access on specific promptsAttention backend kernel hit an edge-case shape or compile mismatch.Test fallback attention backend flags and reproduce with CUDA_LAUNCH_BLOCKING=1.

Evidence checklist

  • lmsysorg/sglang image tag and Python/CUDA/FlashInfer versions
  • Complete sglang.launch_server CLI arguments including --tp, --nnodes, and --mem-fraction-static
  • nvidia-smi output and df -h /dev/shm
  • NCCL_DEBUG=INFO logs across all participating nodes
  • Host kernel dmesg for OOM kills or NVIDIA Xids

Common mistakes

Using --mem-fraction-static 0.95 alongside CUDA graphs and large batches

Activation buffers and FlashInfer workspaces need breathing room outside the static KV pool.

Running multi-node SGLang without matching NCCL_SOCKET_IFNAME

Docker bridge interfaces break cross-node NCCL rendezvous and cause silent timeouts.

Forgetting --enable-metrics before configuring Grafana

Without --enable-metrics, Prometheus scrapes return 404 on /metrics.

Frequently asked questions

How do I fix SGLang torch.OutOfMemoryError: CUDA out of memory?

Verify no other processes hold GPU VRAM, then lower --mem-fraction-static (for example from 0.88 to 0.80) or reduce --max-running-requests and --chunked-prefill-size.

Why does SGLang fail with NCCL errors in Docker?

The top causes are Docker default 64 MB /dev/shm (add --shm-size=16g or --ipc=host), wrong NCCL_SOCKET_IFNAME across multi-node hosts, or PCIe P2P blocked on non-NVLink GPUs.

How do I get SGLang Prometheus metrics?

Pass --enable-metrics to sglang.launch_server and scrape /metrics from Prometheus.

What is the official SGLang Docker image?

lmsysorg/sglang on Docker Hub provides prebuilt CUDA, FlashInfer, and PyTorch dependencies aligned for SGLang serving.

Live diagnosis, no signup

Upload your GPU log. Find what happened first.

Get the likely cause, supporting evidence, and next safe steps with the same cloud reasoning used by paid plans. A crash the engine recognizes is answered in seconds, then checked by an independent AI review that updates this page when it finishes. A crash it does not recognize waits for the AI's own answer, which can take a few minutes. No account, card, or installation. Logs are masked at Denpex API ingress and are not saved to account history.

Before uploading, review cloud data handling and local options.

training_logs.txt
No log to hand? Try one:

Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.

3 free cloud diagnoses per day

Try Denpex for 30 days. FREE.

No credit card. No automatic subscription. See whether Denpex helps with an incident you already understand.

Start your free 30-day Team evaluation

Up to 50 diagnoses a day for 30 days. Verify your work email to activate an eligible company evaluation, then replay a resolved incident and compare the evidence and next steps with your team's confirmed cause.

Use your company email, for example alex@yourcompany.com.

Who qualifies?

Company email domains activate the free 30-day Team evaluation (up to 50 diagnoses a day) after an email and domain check, whatever mail provider you use. If we cannot verify your domain automatically, support reviews it: write to support@denpex.com. Free local diagnosis in the editor extension needs no account.

Using a personal email (Gmail, Outlook, Naver, QQ) or solo cluster? Create a free $0 account (no work email required) to save 7-day history and unlock AI fallback, or send a cluster crash log for a live walkthrough.

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