Skip to content

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.

Quick answer

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.
Communication#ddp#port#conflict#distributed#master-port#communication

What this failure is

A port conflict occurs when another listener already owns the address the training launcher is trying to bind.

Live diagnosis, no signup

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.

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

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.

SymptomPossible explanation
Address already in use or EADDRINUSE while binding a rendezvous socketAnother 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.

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.
Already have an account? Sign in

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 logs

No 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

snippet
# 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.py

This 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 extension

torchrun 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 errors

Frequently asked questions

Questions engineers and on-call staff commonly ask about this failure.

Can every rank choose a different random port?
No. Nodes in the same distributed job must agree on its rendezvous endpoint. localhost:0 here is for an independent single-node job.

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.