sgl-project/sglang · critical · RuntimeError

Server process exited

Error message

Server process exited

What it means

_raise_if_process_exited found the process (multiprocessing-style, has is_alive) is dead but exitcode is None — it terminated abnormally (e.g. SIGKILL) without an exit code, so only a generic 'Server process exited' can be reported.

Source

Thrown at python/sglang/utils.py:548

    lock_socket = process_socket_map.pop(process, None)
    if lock_socket is not None:
        release_port(lock_socket)


def _raise_if_process_exited(process: Optional[Any]) -> None:
    if process is None:
        return

    if hasattr(process, "poll"):
        return_code = process.poll()
        if return_code is not None:
            raise RuntimeError(f"Server process exited with code {return_code}")
        return

    if hasattr(process, "is_alive") and not process.is_alive():
        return_code = getattr(process, "exitcode", None)
        if return_code is None:
            raise RuntimeError("Server process exited")
        raise RuntimeError(f"Server process exited with code {return_code}")


def _is_wait_timeout(start_time: float, timeout: Optional[int]) -> bool:
    if timeout is None:
        return False
    return time.perf_counter() - start_time > timeout


def wait_for_http_ready(
    url: str,
    timeout: Optional[int] = None,
    process: Optional[Any] = None,
    headers: Optional[dict] = None,
    request_timeout: int = 5,
) -> None:
    """Wait for an HTTP endpoint to return status 200."""
    start_time = time.perf_counter()

View on GitHub (pinned to 0132848349)

Solutions

  1. Check dmesg/container logs for OOM kills and raise the memory limit
  2. Inspect server logs for the abrupt-termination cause
  3. Retry with reduced memory usage (smaller --mem-fraction-static, shorter context)
Defensive patterns

Strategy: try-catch

Try / catch

try:
    wait_for_http_ready(proc, url)
except RuntimeError as e:
    if 'Server process exited' in str(e):
        check_oom_logs(); raise

Prevention

When it happens

Trigger: Server process killed by SIGKILL (OOM killer, manual kill -9) while wait_for_http_ready polls; exitcode attribute missing or None.

Common situations: OOM killer reaping the server in memory-tight CI; container memory limits; manual kills during debugging.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/e25d878b79461e7b. Report an issue: GitHub.