Respect --server-port in DP mode when proxy-url is set - #4712
Merged
Conversation
lvhan028
requested review from
RunningLeon and
Copilot
and removed request for
Copilot
June 26, 2026 11:10
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the OpenAI serving CLI and DP-mode launcher so that in distributed data-parallel (dp>1) mode, --server-port is respected even when --proxy-url is provided, while still allowing automatic port selection when the user does not specify a port.
Changes:
- Make
launch_server(..., server_port=...)acceptNoneto distinguish “unset” vs “explicitly set”. - Adjust DP-mode port selection to auto-pick ports only when
proxy_urlis set andserver_portis unset. - Change CLI
--server-portdefault toNoneand preserve the effective default port (23333) where appropriate.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lmdeploy/serve/openai/launch_server.py | Updates DP-mode port selection logic to honor an explicitly provided server_port even when proxy_url is set. |
| lmdeploy/cli/serve.py | Changes CLI --server-port default to None to enable “unset” semantics while preserving default behavior in single-server mode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+42
to
+46
| """Validate base port and the contiguous DP port range.""" | ||
| if not 1 <= base_port <= 65535: | ||
| raise ValueError(f'server_port must be between 1 and 65535, got {base_port}') | ||
| end_port = base_port + dp_per_node - 1 | ||
| if end_port > 65535: |
Document the effective default for --server-port and validate explicit base ports before allocating contiguous DP worker ports. Co-authored-by: Cursor <cursoragent@cursor.com>
lvhan028
force-pushed
the
fix/dp-server-port-with-proxy
branch
from
July 1, 2026 03:38
77b30d7 to
337947e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.