SGLang multi-node: auto-negotiated dist_init port can collide with pre-allocated engine ports
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- python
调研方向
从 angelspec/inference/factory.py 中的 _prepare_sgl_engines 开始,同时阅读 Step 2 和 Step 2.5,然后跟踪 SglEngine.init,以确认 port 和 dist_init_addr 的分配方式。确保在 multi-node SGLang 路径中,自动协商的 dist-init 端口不会与预先分配的 engine 端口重叠,尤其是在默认值从 10000 开始时。
由索引模型根据 Issue 内容生成。
描述
In _prepare_sgl_engines (angelspec/inference/factory.py), Step 2 picks a free port for dist_init_addr starting from the default start_port=10000:
https://github.com/Tencent/AngelSpec/blob/main/angelspec/inference/factory.py#L288-L295
ip, port = ray.get(
[head_engine.get_node_ip.remote(), head_engine.find_free_port.remote()],
timeout=120,
)
find_free_port only probes ports; it never reserves them. Step 2.5 then restarts its sequential allocation at the literal next_start = 10000 without accounting for the port just handed out:
https://github.com/Tencent/AngelSpec/blob/main/angelspec/inference/factory.py#L297-L309
next_start = 10000
for i in range(num_engines):
port = ray.get(engines[i].find_free_port.remote(start_port=next_start, consecutive=2), ...)
pre_allocated_ports[i] = port
next_start = port + 2
On a fresh node, Step 2 returns 10000 and Step 2.5 immediately hands engine 0 (which is the replica-0 head on the same node) ports 10000/10001. SglEngine.init then sets port=10000, nccl_port=10001, and dist_init_addr="<same-ip>:10000" — the head node is told to bind its server port and its dist-init TCPStore on the same port. The Step 2.5 comment says "allocate sequentially so engines on the same node never collide", but the Step 2 allocation is invisible to that sequencer.
The vLLM path avoids this by reusing the head's pre-allocated port as the dist-init port rather than drawing a second untracked port. Possible fixes: allocate the dist-init port from the same sequential allocator (e.g. run Step 2 after Step 2.5 using next_start, or advance next_start past the negotiated dist-init port). Only affects sglang_nnodes > 1 with auto-negotiated addr.
- 主要语言
- Python
- 星标
- 460
- 派生
- 40
- 平均合并
- 1 小时 4 分钟
- 30 天内合并 PR
- 4
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Tencent/AngelSpec 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 4/5 3-5 天 新手友好度 52/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 55/100
-
enhancement
难度 4/5 3-5 天 新手友好度 48/100
查看 Tencent/AngelSpec 的全部 Issue
相似的 Issue
-
ui
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
accepted
难度 2/5 1-3 小时 新手友好度 68/100
future-agi/future-agi#5070 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
juandresrodca/AdminForge#69 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
deepset-ai/haystack-integrations#817 ·
维护者通常 12 天内回复
-
[Bug]: test_remote_realpath_uses_argument_vector fails on Windows with Python 3.13+ (ntpath.isabs)可能已有人在做 @gouyu-hou 今天认领。 未关闭triage/confirmed
难度 1/5 1 小时以内 新手友好度 90/100
agentscope-ai/agentscope#4397 ·
维护者通常 2 天内回复