#62480·ray

[Serve][LLM] SGLangServer multi-replica support

Author: eicherseijiCreated Apr 9, 2026Updated Sep 29, 2026
Labelsbuggood-first-issuetriageservellmstabilityhelp-wanted

What happened + What you expected to happen

Three blockers

ray.exceptions.ActorAlreadyExistsError: The name sglang_scheduler_rank0node=10.0.197.129_pp0_tp0 (namespace=None) is already taken.

Causes OOM because mp backend does not set CUDA visible devices:

torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 512.00 MiB. GPU 0 has a total capacity of 22.03 GiB of which 408.94 MiB is free. Process 63764 has 17.97 GiB memory in use.
torch.distributed.DistNetworkError: The server socket has failed to listen on any local network address. port: 30233, useIpv6: false, code: -98, name: EADDRINUSE, message: address already in use

Versions / Dependencies

Docker image: rayproject/ray-llm:nightly-py311-cu128

pip3 uninstall -y vllm
pip3 install "sglang[all,ray]==0.5.10rc0"
# Reinstall opentelemetry-proto to regenerate _pb2.py files compatible with
# the protobuf version that sglang pulls in (protobuf 4.x+ removed old-style
# descriptor creation, causing Ray dashboard to crash on startup).
pip3 install --upgrade opentelemetry-proto opentelemetry-sdk opentelemetry-exporter-prometheus

Reproduction script

python
import sys

import httpx
import pytest
from openai import OpenAI

from ray import serve
from ray._common.test_utils import wait_for_condition
from ray.llm.examples.sglang.modules.sglang_engine import SGLangServer
from ray.serve._private.constants import SERVE_DEFAULT_APP_NAME
from ray.serve.llm import LLMConfig, build_openai_app
from ray.serve.schema import ApplicationStatus



MODEL_ID = "Qwen/Qwen2.5-0.5B-Instruct"
RAY_MODEL_ID = "qwen-0.5b-sglang"

llm_config = LLMConfig(
    model_loading_config={
        "model_id": RAY_MODEL_ID,
        "model_source": MODEL_ID,
    },
    deployment_config={
        "autoscaling_config": {
            "min_replicas": 2,
            "max_replicas": 2,
        }
    },
    server_cls=SGLangServer,
    engine_kwargs={
        "model_path": MODEL_ID,
        "tp_size": 1,
        "mem_fraction_static": 0.8,
        "use_ray": True
    },
)

app = build_openai_app({"llm_configs": [llm_config]})
serve.run(app, blocking=False)

Issue Severity

None