Most NCCL errors and hangs fall into four symptoms: a failure at startup, a watchdog timeout, a silent hang, or one rank crashing and taking the rest down, and each has its own first check. On Nodus, a rank that exits non-zero fails the run instead of being retried, and nodus logs job/NAME --rank 1 reads each machine's log even after its capacity is gone. Before you blame the network, check whether one rank called a different collective than the others, a bug we reproduce three ways below.
This is the playbook for a job that is already broken. Launch setup, ports and NCCL_SOCKET_IFNAME are covered in our multi-node training guide, and DDP versus FSDP in our multi-GPU training guide.
Which kind of NCCL failure do you have?
Classify before you change anything, because the fixes do not overlap. Read the log of every rank, not only rank 0, since the rank that reports an error is often not the one that caused it.
| Symptom | What it usually means | First thing to run |
|---|---|---|
Error during init_process_group or the first collective, such as "unhandled system error" |
An external library call failed: shared memory, GPU peer access or the network |
NCCL_DEBUG=WARN, then INFO
|
| "Watchdog caught collective operation timeout" after about 10 minutes | Some rank never joined a collective |
TORCH_DISTRIBUTED_DEBUG=DETAIL, flight recorder |
| No output, no error, GPUs held | A stall outside any collective, or a timeout that is disabled or very long |
py-spy dump on every rank |
| One rank dies, the others report "connection closed" | A real crash on one rank | That rank's own log |
Why does NCCL fail at initialization?
An init failure means NCCL could not use a resource it needs, and its warning message names it. NCCL's own error string for a system error is unhandled system error (run with NCCL_DEBUG=INFO for details). The NCCL troubleshooting guide says ncclUnhandledCudaError and ncclSystemError mean a call to an external library failed, while ncclInvalidArgument and ncclInvalidUsage point to a bug in your code. Setting NCCL_DEBUG=WARN prints the explicit warning before the error returns.
The most common container cause is shared memory. The same guide shows the message NCCL WARN Error: failed to extend /dev/shm/nccl-03v824 to 4194660 bytes and says Docker defaults to limited shared memory. Its suggested launch flags are --shm-size=1g --ulimit memlock=-1.
If shared memory is fine, isolate the transport. The NCCL environment variable docs describe NCCL_P2P_DISABLE=1, which turns off direct GPU-to-GPU copies over NVLink or PCI, and NCCL_SHM_DISABLE=1, which turns off the shared memory transport. Use them to diagnose, then remove them, because they make the job slower.
If the job runs only with P2P disabled, the GPU troubleshooting page names IOMMU settings and PCI Access Control Services as common bare-metal causes. It suggests nvidia-smi topo -p2p p (PCIe) or -p2p n (NVLink) to check peer access.
For more detail, NCCL_DEBUG=INFO prints debug information, filtered by NCCL_DEBUG_SUBSYS (default INIT,BOOTSTRAP,ENV). NCCL_DEBUG_FILE=nccl.%h.%p writes one file per host and process.
What does a watchdog timeout actually tell you?
A watchdog timeout says one collective waited longer than the process group timeout, nothing more. The PyTorch distributed docs set that timeout at 10 minutes for NCCL and 30 minutes for other backends. After it, collectives are aborted and the process crashes, because continuing could run CUDA work on corrupted data. The timeout message comes from PyTorch's NCCL work tracking code.
Teardown is controlled by TORCH_NCCL_ASYNC_ERROR_HANDLING, which the PyTorch NCCL environment variable page sets to 3 by default: tear down the process without aborting the communicator. Leave it on, because a dead process is visible to your launcher and a waiting one is not.
The useful question is which rank was missing and why. Often that rank was busy elsewhere, loading data, writing a checkpoint or running a different branch of your code.
Why does one rank skip or reorder a collective?
Collectives must be called in the same order, with the same shapes, on every rank. Code that breaks this rule looks innocent: a dataloader that gives one rank fewer batches, an if rank == 0 block that logs a metric with all_reduce, or an early continue on a bad sample.
We reproduced three of these on December 5, 2026, on a CPU sandbox with PyTorch 2.15, 2 processes under torchrun and the Gloo backend. We used a 20 second timeout instead of the default. NCCL prints different messages for the same bugs, so treat the wording below as Gloo's.
Each run is one command:
MODE=skip torchrun --nproc-per-node 2 desync.py
MODE=skip TORCH_DISTRIBUTED_DEBUG=DETAIL TORCH_CPP_LOG_LEVEL=INFO \
torchrun --nproc-per-node 2 desync.py
In the skip case, rank 1 skips one all_reduce at step 1. Nothing failed there. Rank 1's step 2 all_reduce paired with rank 0's step 1, both finished, and the job hung at the next call until Timed out waiting 20000ms for recv operation to complete. A skipped collective can silently pair with the wrong call and exchange the wrong data before anything hangs.
In the uneven case, rank 1 had 4 batches and rank 0 had 5. Rank 1's one-element metric all_reduce met rank 0's 1,024-element gradient all_reduce, and Gloo aborted with Received data size doesn't match expected size. Is there a distributed collective mismatch in your code? NCCL does not always check sizes this way, so the same bug can hang instead.
How does TORCH_DISTRIBUTED_DEBUG=DETAIL find the culprit?
DETAIL turns a 10 minute mystery into an immediate error that names both calls. The PyTorch docs say it adds collective synchronization checks, may slow the job, and belongs only in debugging runs. With TORCH_SHOW_CPP_STACKTRACES=1 it also logs the call stack of a desync.
In our reorder run, rank 0 called all_reduce then broadcast, and rank 1 did the reverse. With DETAIL it failed in 4.0 seconds with RuntimeError: Detected mismatch between collectives on ranks, followed by Op type: ALLREDUCEvs BROADCAST. The uneven run reported Tensor Tensor shapes: 1024vs 1.
The skip run shows its limit. DETAIL caught the mismatch at the final barrier, one step late, because the two shifted all_reduce calls had identical shapes. It tells you where the ranks diverged, not always where the bug is.
| Bug | Default, time to exit | With DETAIL, time to exit |
|---|---|---|
| Uneven batches | 5.4 s (Gloo size check) | 4.1 s |
Skipped all_reduce
|
23.9 s (timeout) | 4.1 s |
| Reordered calls | 23.9 s (timeout) | 4.0 s |
Times are wall-clock for the whole torchrun command, including startup.

With the default 10 minute NCCL timeout, the two timeout cases would wait 600 seconds instead of 20.
How do you debug a hang that never times out?
Dump the Python stack of every rank, because a hang is a disagreement about where each rank is. py-spy attaches to a running process without stopping it. In our skip run with a 60 second timeout, py-spy dump --pid <pid> on each process showed the answer in two lines: rank 0 at all_reduce (desync.py:41) and rank 1 at barrier (desync.py:43).
The process group timeout only covers operations on the process group. If every rank is stuck in a dataloader or a checkpoint write, there is no collective to time out, and the job can sit idle until someone notices.
For NCCL jobs, the flight recorder keeps a ring buffer of recent collectives on each rank. The Flight Recorder tutorial sets TORCH_NCCL_TRACE_BUFFER_SIZE=2000 and TORCH_NCCL_DUMP_ON_TIMEOUT=1 to write one file per rank on timeout, then reads them with torchfrtrace; in the tutorial's example, it reports that rank 1 did not join the all_reduce. PyTorch 2.15 warned us that TORCH_NCCL_TRACE_BUFFER_SIZE is deprecated in favor of TORCH_FR_BUFFER_SIZE. Our Gloo run wrote no dump, so we have not tested the tool ourselves.
If the code looks right, test the hardware path without your code. nccl-tests checks both performance and correctness, and ./build/all_reduce_perf -b 8 -e 128M -f 2 -g 8 runs it on one machine with 8 GPUs. If that hangs too, the problem is the machine or network, not your training script.
What does a hang cost on 8 x H100?
A single timeout is cheap, but an unnoticed stall is not. An NVIDIA H100 is listed at $2.60/hr on the Nodus pricing page, so one 8 x H100 machine costs 8 x $2.60 = $20.80 per hour whether it trains or waits.
The 10 minute default NCCL timeout idles that machine for $20.80 / 6 = $3.47. On two machines it is $6.93. A stall outside any collective that runs 8 hours overnight costs 8 x $20.80 = $166.40, and every relaunch that hits the same desync adds another timeout. Prices checked December 5, 2026.

The timeout is not the expensive part; a hang nobody sees is.
Shorten the timeout only if you know your slowest step. A short timeout= in init_process_group also aborts legitimate waits, such as the other ranks at a barrier while rank 0 saves a large checkpoint.
What does Nodus do when a rank fails?
Nodus treats a crash and a lost machine differently. According to the multi-node guide, if your command exits non-zero on any rank the run fails, and the first failure's cause is reported as the run's reason. The attempts and recovery docs say failures caused by your command fail fast and are not retried, so a deterministic desync does not loop.
A lost or reclaimed machine is different. Nodus stops every rank, replaces only the lost machine and restarts all ranks from the latest checkpoint in $NODUS_CHECKPOINT_DIR, so your script needs to save there, as our checkpoint guide shows.
For the logs, the logs guide shows nodus logs job/NAME --rank 1 for one machine's output and --attempt 1 for an earlier attempt whose machine is gone. Logs are kept for 30 days. Nodus' own scheduling and recovery messages are separate events, shown by nodus describe job/NAME.
FAQ
Do I need TORCH_NCCL_BLOCKING_WAIT?
Rarely. The PyTorch docs say only that with TORCH_NCCL_BLOCKING_WAIT set, the process blocks and waits for the timeout. The default teardown already crashes the process when a collective times out.
Can I debug collective bugs on CPU before paying for GPUs?
Yes, for logic bugs. Switching the backend to Gloo reproduces collective order and shape bugs on a laptop, as our runs did, but not shared memory, P2P or network faults, which only appear with NCCL on GPUs.
Does Nodus restart my job after an NCCL timeout?
No. A timeout crashes the process with a non-zero exit, which Nodus treats as a failure of your command and does not retry. It restarts automatically when a machine is lost or reclaimed, from your latest checkpoint.
Originally published on the Nodus blog.
Top comments (0)