Skip to content

[Fix] rust-server: Derive advertised host towards dist_init_addr and reject loopback on multi-node - #47534

Open
devtyagi3909 wants to merge 1 commit into
sgl-project:mainfrom
devtyagi3909:fix-rust-server-advertised-host
Open

devtyagi3909 wants to merge 1 commit into
sgl-project:mainfrom
devtyagi3909:fix-rust-server-advertised-host

Conversation

@devtyagi3909

@devtyagi3909 devtyagi3909 commented Oct 30, 2026 •

Copy link
Copy Markdown

closes #47509

why

in multi-node deployments with rust server (SGLANG_RUST_SERVER=1), gather_server_endpoints() resolved wildcard listener binds (0.0.0.0, ::) via get_local_ip_auto(fallback="127.0.0.1"). on multi-homed or isolated cluster nodes without default routes, this can either pick an unroutable interface or fall back to loopback (127.0.0.1). when it fell back to loopback, it only logged a warning and published 127.0.0.1:<port> anyway. other ranks then relayed control requests (/flush_cache, /start_profile, etc.) to 127.0.0.1, which routed to their own local listener at the same offset rather than the target rank.

also, _rendezvous_is_loopback failed to recognize schemes in dist_init_addr like tcp://127.0.0.1:5000 because NetworkAddress.parse did not strip scheme prefixes.

what changed

  1. added get_local_ip_towards() in network.py that probes a connected udp socket towards target host/port (getsockname, no network traffic sent).
  2. in gather_server_endpoints(), when wildcard host is bound:
    • honors explicit SGLANG_HOST_IP / HOST_IP if set.
    • derives source ip on the interface routing towards dist_init_addr when set.
    • falls back to get_local_ip_auto(fallback="127.0.0.1").
  3. rejects loopback listener on multi-node (nnodes > 1) with ValueError when rendezvous is not loopback, preventing silent misrouting across nodes.
  4. updated NetworkAddress.parse() to strip scheme prefixes (tcp://, http://), enabling _rendezvous_is_loopback to correctly parse dist_init_addr.
  5. added unit tests covering towards probing, scheme parsing, fallback, env override, and multi-node loopback rejection.

test

  • PYTHONPATH=python python3 -m unittest discover -s test/registered/utils -p "test_network_address.py" (55 passed)
  • PYTHONPATH=test:python python3 -m unittest registered.unit.multimodal.rust.shared.test_rust_server_extension.TestRustServerExtension (all passed)
  • ruff check --select=F401,F821,F823,UP037 clean
  • isort --check-only clean

CI States

Latest PR Test (Base): ❌ Run #42372272873
Latest PR Test (Extra): ❌ Run #42372272720
Latest PR Test (AMD ROCm 10): ❌ Run #42372272737

Tip

Base CI only covers the core cases, and its workload may not exercise your change. Use /rerun-test to run the tests your change touches, or copy this prompt for an agent:

Find the registered tests this PR affects and run them with /rerun-test, following https://github.com/sgl-project/sglang/blob/main/.agents/skills/rerun-test/SKILL.md

@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.

@devtyagi3909
devtyagi3909 force-pushed the fix-rust-server-advertised-host branch from 417f0b1 to 741d74d Compare November 7, 2026 12:23

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] rust-server: gather_server_endpoints can advertise a loopback or unroutable address to other nodes, and only warns

1 participant