Skip to content

[Bugfix] Avoid TCPStore port collision for co-located non-DP Ray engines - #53666

Merged
njhill merged 1 commit into
vllm-project:mainfrom
jeffreywang88:ray-v2-tcpstore-port-non-dp
Aug 27, 2026
Merged

njhill merged 1 commit into
vllm-project:mainfrom
jeffreywang88:ray-v2-tcpstore-port-non-dp

Conversation

@jeffreywang88

@jeffreywang88 jeffreywang88 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

_select_tcpstore_port treats local_dp_rank is None as "no DP", but a non-DP config sets it to 0.

https://github.com/vllm-project/vllm/blob/342b8ebd8b/vllm/v1/executor/ray_executor_v2.py#L272
https://github.com/vllm-project/vllm/blob/342b8ebd8b/vllm/config/parallel.py#L920.

Every co-located engine then picks port 100; two replicas on one host race and one dies with EADDRINUSE. This PR fixs this by passing None when there's no DP group.

Ray Serve LLM tests do run 2 replicas × TP=2 per node, but Serve restarts the crashed replica, which then finds 100 taken and uses 101, and therefore the app goes healthy and the test passes.

Test Plan

Two TP=2 servers started together on one host (4 GPUs):

vllm serve Qwen/Qwen3-0.6B --tensor-parallel-size 2 --distributed-executor-backend ray \
    --enforce-eager --max-model-len 2048 --gpu-memory-utilization 0.20 \
    --load-format dummy --port 8500 &

vllm serve Qwen/Qwen3-0.6B --tensor-parallel-size 2 --distributed-executor-backend ray \
    --enforce-eager --max-model-len 2048 --gpu-memory-utilization 0.20 \
    --load-format dummy --port 8501 &

Also added unit tests: pytest tests/distributed/test_ray_v2_executor.py.

Test Result

  • Before: Both logged tcp://<ip>:100; second died with EADDRINUSE.
  • After: Ports 50851 and 47047, both served.

AI Assistance

This PR is written with Claude Code assistance, and I've reviewed every line.


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Signed-off-by: Jeffrey Wang <jeffreywang@anyscale.com>
@jeffreywang88
jeffreywang88 requested a review from njhill as a code owner August 25, 2026 03:12

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify mergify Bot added bug Something isn't working ray anything related with ray labels Aug 25, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Ray Aug 25, 2026
@jeffreywang88

jeffreywang88 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Ray's integration tests https://buildkite.com/ray-project/release/builds/105307/table passed.

@jeffreywang88

Copy link
Copy Markdown
Contributor Author

/ci run

@github-actions

Copy link
Copy Markdown

❌ @jeffreywang88, A reviewer with write access must run /ci run, approve the PR, or add the ready label first.

@jeffreywang88

Copy link
Copy Markdown
Contributor Author

Hey @njhill could you please review? thank you!

@njhill njhill left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jeffreywang88!

@njhill njhill added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 27, 2026
@njhill

njhill commented Aug 27, 2026

Copy link
Copy Markdown
Member

/ci run

@njhill
njhill enabled auto-merge (squash) August 27, 2026 18:35
@github-actions

Copy link
Copy Markdown

✅ @jeffreywang88, CI is now available for this PR.

  • /ci run starts upstream CI; /amd-ci run starts AMD CI only.
  • /ci retry retries failed jobs in the CI build for the current PR head. If the current head has no CI build, it starts a new CI build for the current head containing only jobs that failed in the latest earlier CI build for this PR.
  • /amd-ci retry retries failed jobs in AMD CI for the current PR head. Use /amd-ci run when the current head has no AMD CI build.
  • /ci cancel cancels scheduled or running CI builds for this PR branch; /amd-ci cancel does the same for AMD CI only.

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #85860 for commit adec1472d0b6.

@njhill
njhill merged commit 79378fe into vllm-project:main Aug 27, 2026
100 of 101 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Ray Aug 27, 2026
aoshen02 added a commit to aoshen02/vllm that referenced this pull request Aug 28, 2026
vllm/v1/executor/ray_executor_v2.py: keep binder-side TCPStore port selection on the rank-0 actor; drop main's driver-side _select_tcpstore_port call (vllm-project#53666), which the bind-and-hold approach subsumes. main's sharded_rdt actor options (vllm-project#43375) auto-merged.
tests/distributed/test_ray_v2_executor.py: keep test_dist_init_store_owns_port; drop main's _select_tcpstore_port tests including test_colocated_tcpstore_ports_differ, since that helper no longer exists.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: aoshen02 <aoshen02@users.noreply.github.com>
am-cohere pushed a commit to am-cohere/vllm that referenced this pull request Sep 1, 2026
…nes (vllm-project#53666)

Signed-off-by: Jeffrey Wang <jeffreywang@anyscale.com>
mikeshawcode pushed a commit to mikeshawcode/vllm that referenced this pull request Sep 1, 2026
…nes (vllm-project#53666)

Signed-off-by: Jeffrey Wang <jeffreywang@anyscale.com>
Signed-off-by: mikeshawcode <michaelwshaw2@gmail.com>
mylibrar pushed a commit to tanyuqian/vllm that referenced this pull request Sep 3, 2026
…nes (vllm-project#53666)

Signed-off-by: Jeffrey Wang <jeffreywang@anyscale.com>
@yfw yfw mentioned this pull request Sep 10, 2026
4 tasks done
yfw added a commit to NVIDIA-NeMo/RL that referenced this pull request Sep 14, 2026
vLLM 0.29 ships vllm-project/vllm#53666 and #50969: RayWorkerV2 now
binds the torch.distributed TCPStore itself on a kernel-assigned port
and holds the socket (`self._dist_init_store = store`) until
init_process_group reuses it, so the probe/bind window that let the
MessageQueue take the same port is gone, and `_select_tcpstore_port`
no longer exists. `_patch_vllm_ray_executor_v2_tcpstore_port` therefore
found no anchor and logged "may fail with EADDRINUSE" on every worker
start.

Detect the upstream marker, log at info level and leave the file alone.
The port-arithmetic tests skip when the installed vLLM carries the
upstream fix; a new test pins the no-warn/no-edit behaviour against a
synthetic 0.29-style source.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ray anything related with ray ready ONLY add when PR is ready to merge/full CI is needed

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants