[Bugfix]: strip @rank suffix in DP intra-node GET proxy URLs - #221
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes intra-node data-parallel (DP) GET proxying when worker registry URLs include an @rank suffix by ensuring GET requests use the base worker URL (without @rank) and carry the DP rank via header, aligning behavior with the existing chat POST routing.
Changes:
- Update
proxy_get_requestto parse DP-aware worker URLs and addX-data-parallel-rankwhen applicable. - Add an e2e regression test ensuring
GET /v1/modelssucceeds through a DP=2 regular router and returns the worker’s model list.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/routers/http/router.rs |
Fixes GET proxy URL construction for DP-aware worker URLs and adds DP rank header. |
tests/test_dp_routing.rs |
Adds regression coverage for GET /v1/models under DP=2. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| let mut request_builder = | ||
| dp_utils::add_dp_rank_header(self.client.get(&url), dp_rank); | ||
| for (name, value) in headers { |
81c8ff4 to
b5f0eb0
Compare
proxy_get_request forwarded worker URLs including the @rank suffix (e.g. http://127.0.0.1:18100@0/v1/models) to reqwest, which parses @ as RFC 3986 userinfo and sends the request to the rank digit as host instead of the worker. GET /v1/models, /health_generate, /get_server_info, and /get_model_info returned 500 with DP > 1 (error sending request for url (http://0.0.0.0/v1/models)). Parse the worker URL with dp_utils::parse_worker_url and add the X-data-parallel-rank header via dp_utils::add_dp_rank_header, matching the chat POST path. DP=1 is unchanged (no @rank, no extra header). Fixes vllm-project#220 Co-authored-by: herotai214 <herotai214@gmail.com> Signed-off-by: WU Hang <whlbx@hotmail.com>
b5f0eb0 to
2c7fbb8
Compare
Signed-off-by: WU Hang <whlbx@hotmail.com>
708e5e0 to
6c6dcf1
Compare
|
Thanks for the fix! Parsing the worker URL before constructing the GET request looks correct and addresses #220. Preserving the selected worker’s DP rank in the header also makes sense, even though endpoints such as I have two suggestions before merging:
It would be useful to cover the second case with a conflicting client header and assert that the worker receives exactly one rank value matching the router’s selection. That assertion should inspect all values, since the existing capture helper stores headers in a |
Address PR review feedback: - proxy_get_request: skip forwarding a client-supplied x-data-parallel-rank when the router injects its selected rank, so workers see exactly one value. DP=1 passthrough is unchanged. - Mock worker /v1/models now captures request headers; CapturedRequest stores all header values (HashMap<String, Vec<String>>) to preserve duplicates. - test_regular_router_dp2_get_v1_models now asserts the forwarded rank matches the selected worker's rank. - New test_regular_router_dp2_get_v1_models_overrides_client_dp_rank sends a conflicting client rank (99) and asserts the worker receives exactly one router-selected rank value. Signed-off-by: WU Hang <whlbx@hotmail.com>
|
Thanks @fake0fan! Both suggestions are addressed in 9480f7e:
All gates pass: |
fake0fan
left a comment
There was a problem hiding this comment.
Thanks for addressing both points! The header filtering and duplicate-preserving capture cover the concerns I raised. The updated tests look sufficient for this fix. LGTM.
Fix #220: intra-node DP GET proxies fail when worker URLs contain
@rank.When
--intra-node-data-parallel-size > 1, worker registry URLs carry an@ranksuffix (e.g.http://127.0.0.1:18100@0).proxy_get_requestforwarded these URLs to reqwest without stripping@rank, so reqwest parsed@as RFC 3986 userinfo and sent the request to the rank digit as host instead of the worker (e.g.GET /v1/modelsbecame a request tohttp://0.0.0.0/v1/modelsand returned 500). Chat POST already stripped@rank; GET did not.Purpose
Fix #220 (worker URLs with
@rankare misinterpreted as userinfo in intra-node DP GET proxies).proxy_get_requestnow parses the worker URL withdp_utils::parse_worker_urland setsX-data-parallel-rankviadp_utils::add_dp_rank_header, matching the chat POST path. DP=1 is unchanged (no@rank, no extra header).GET /v1/models,GET /health_generate,GET /get_server_info,GET /get_model_info.GET /healthwas already fine (send_health_checkstrips@rank).test_regular_router_dp2_get_v1_modelsintests/test_dp_routing.rs: assertsGET /v1/modelsthrough a DP=2 regular router returns 200 with the worker's model list. Verified the test fails on the previous implementation (500 from the userinfo-corrupted URL) and passes with the fix.Test Plan
cargo test --test test_dp_routing test_regular_router_dp2_get_v1_modelscargo test --test test_dp_routingcargo test --test test_transparent_proxy_routing --test api_endpoints_testcargo test --lib --binscargo fmt --checkcargo clippy --all-targets --all-features -- -D warningsTest Result
Before the fix, the regression test fails (worker never receives the request):
Essential Elements of an Effective PR Description Checklist