DDP Address Already in Use: torchrun Port Conflicts
Diagnose DDP address-already-in-use errors. Check the listening process and rendezvous endpoint for independent single-node jobs or a multi-node run.
Check which process owns the rendezvous port. Independent single-node torchrun jobs can use localhost:0 with the c10d backend; a multi-node job needs one shared, reachable endpoint.
- Root cause
- Another launcher owns the chosen address and port. Independent jobs use the same rendezvous endpoint.
- Recommended fix
- For independent single-node c10d jobs, let torchrun select an available port with --rdzv-endpoint=localhost:0.
- How Denpex helps
- Denpex investigates DDP Address Already in Use: torchrun Port Conflicts using the evidence you provide or your connected workload collects. Earlier rank, host or application evidence is needed to distinguish an initiating failure from a downstream report.
What this failure is
A port conflict occurs when another listener already owns the address the training launcher is trying to bind.
Is this what broke your run? Paste your log.
You're reading about DDP Address Already in Use: torchrun Port Conflicts. Paste your own traceback and relevant evidence for an investigation of your workload, with a next action or a specific missing fact. A reference entry does not establish your cause. No account or card for the free diagnosis. Review data handling before submitting sensitive logs.
Before uploading, review cloud data handling and local options.
Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.
Why it happens (the mechanism)
Two launchers can share a default port, or a previous launcher can still be running. A timeout without a bind error can instead indicate endpoint reachability or inconsistent launch arguments.
What you'll observe
- A distributed job fails during rendezvous before training begins.
Common symptoms and what they mean
Check possible explanations against the incident evidence. A matching symptom alone does not establish its cause.
| Symptom | Possible explanation |
|---|---|
| Address already in use or EADDRINUSE while binding a rendezvous socket | Another launcher owns the chosen address and port. |
Which systems are affected
- PyTorch torchrun and distributed training launchers
How to confirm this is the problem
Use this checklist to test the hypothesis against a small reproduction. No single line proves the root cause, so preserve the preceding events and compare one variable at a time.
- ✓Read the complete traceback and actual launcher arguments.
- ✓On Linux, inspect the listener with ss -ltnp and identify its job owner before changing it.
Root cause
- Another launcher owns the chosen address and port.
- Independent jobs use the same rendezvous endpoint.
The fix and how to prevent it
How to fix it
- For independent single-node c10d jobs, let torchrun select an available port with --rdzv-endpoint=localhost:0.
- For a multi-node job, allocate a distinct endpoint per job and use that same endpoint on every node.
- Stop an obsolete launcher only after confirming its owner and workload. Do not kill an unrelated process to free a port.
- Relaunch and check that every expected rank joins the intended job.
How to prevent it
- Allocate rendezvous endpoints per job in the scheduler or launch wrapper.
Save this diagnosis and catch the next crash automatically
All root cause, fix, and prevention steps above are free to read. Create a free account with any email or GitHub to keep your saved diagnosis history across the encyclopedia and run cloud checks, or use a work email below for the 30-day Team evaluation. No card required.
Or start a 30-day free Team trial (work email)
Verified work email unlocks all 14 fleet diagnostic tools, Slack alerts, and team history for 30 days. No card and no automatic charge.
Diagnose your own log automatically
The root cause and fix steps above stay free. Create a free account to analyze full job logs, attribute the first failed rank, and keep saved incident history.
Sign up free. Analyze your cluster logsNo credit card. Daily allowance follows verified trust tier. Instant access.
Why the recommended fix works
Separate endpoints prevent independent jobs from competing for the same listening socket.
Code examples
# Single-node example with two workers and your training script
torchrun --rdzv-backend=c10d --rdzv-endpoint=localhost:0 --nnodes=1 --nproc-per-node=2 train.pyThis snippet illustrates the entry-specific check. Verify the installed versions, permissions, target and workload context before using it. A command or API example is not proof of recovery.
Diagnostic note
“The example follows the documented stacked single-node launch pattern. It is not a multi-node configuration or a claim of a successful hardware test.”
Diagnose this failure in VS Code
Select the traceback or open the failed terminal, then run Denpex locally to inspect matched failure patterns, supporting evidence and next checks without uploading the log. Verify recommendations against your workload before changing production.
Install the free VS Code extensiontorchrun errors in context
torchrun startup hangs and EADDRINUSE crashes trace back to rendezvous endpoints, world-size mismatches, or earlier rank initialization exits.
Compare related torchrun errorsRelated failures to investigate next
Frequently asked questions
Questions engineers and on-call staff commonly ask about this failure.
Can every rank choose a different random port?
Don't just read the fix, diagnose your run
The encyclopedia explains documented failure patterns. Denpex investigates your logs, configuration and stack, shows the supporting evidence, and asks for missing details when needed.