[Core] Cleanup shm based object store on engine shutdown (#32429)

Signed-off-by: walterbm <walter.beller.morales@gmail.com>
This commit is contained in:
Walter Beller-Morales
2026-01-20 08:53:37 +00:00
committed by GitHub
parent e1a34c3a5d
commit 8be263c3fb
7 changed files with 57 additions and 7 deletions
+27 -2
View File
@@ -7,6 +7,7 @@ import logging
import os
import sys
import tempfile
import uuid
from collections.abc import Callable
from typing import TYPE_CHECKING, Any, Literal
@@ -457,6 +458,27 @@ def get_vllm_port() -> int | None:
raise ValueError(f"VLLM_PORT '{port}' must be a valid integer") from err
def get_env_or_set_default(
env_name: str,
default_factory: Callable[[], str],
) -> Callable[[], str]:
"""
Create a lambda that returns an environment variable value if set,
or generates and sets a default value using the provided factory function.
"""
def _get_or_set_default() -> str:
value = os.getenv(env_name)
if value is not None:
return value
default_value = default_factory()
os.environ[env_name] = default_value
return default_value
return _get_or_set_default
# The start-* and end* here are used by the documentation generator
# to extract the used env vars.
@@ -1558,8 +1580,11 @@ environment_variables: dict[str, Callable[[], Any]] = {
),
# Name of the shared memory buffer used for object storage.
# Only effective when mm_config.mm_processor_cache_type == "shm".
"VLLM_OBJECT_STORAGE_SHM_BUFFER_NAME": lambda: os.getenv(
"VLLM_OBJECT_STORAGE_SHM_BUFFER_NAME", "VLLM_OBJECT_STORAGE_SHM_BUFFER"
# Automatically generates a unique UUID-based name per process tree
# if not explicitly set.
"VLLM_OBJECT_STORAGE_SHM_BUFFER_NAME": get_env_or_set_default(
"VLLM_OBJECT_STORAGE_SHM_BUFFER_NAME",
lambda: f"VLLM_OBJECT_STORAGE_SHM_BUFFER_{uuid.uuid4().hex}",
),
# The size in MB of the buffers (NVL and RDMA) used by DeepEP
"VLLM_DEEPEP_BUFFER_SIZE_MB": lambda: int(