{"record":{"id":"e2747c94268596f4","repo":"sgl-project/sglang","slug":"memory-size-must-be-positive-e2747c","errorCode":null,"errorMessage":"memory_size must be positive","messagePattern":"memory_size must be positive","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/utils/cuda_vmm_transport_utils.py","lineNumber":182,"sourceCode":"def get_vmm_feature_consumer_count() -> int:\n    if get_parallel().enable_dp_attention:\n        return get_parallel().tp_size // get_parallel().dp_size\n    return get_parallel().tp_size\n\n\nclass CudaVmmMemoryPool:\n    \"\"\"Bounded CUDA VMM pool shared through FABRIC or a local POSIX FD.\"\"\"\n\n    def __init__(\n        self,\n        memory_size: int,\n        recycle_interval: float,\n        base_gpu_id: int,\n        consumer_count: int,\n        allow_posix_fallback: bool = False,\n    ) -> None:\n        if memory_size <= 0:\n            raise ValueError(\"memory_size must be positive\")\n        if consumer_count <= 0:\n            raise ValueError(\"consumer_count must be positive\")\n        if recycle_interval <= 0:\n            raise ValueError(\"recycle_interval must be positive\")\n\n        self.device_index = int(base_gpu_id)\n        self.consumer_count = int(consumer_count)\n        self._recycle_interval = float(recycle_interval)\n        self._lock = threading.Lock()\n        self._publisher_condition = threading.Condition(self._lock)\n        self._shutdown_lock = threading.Lock()\n        self._active_publishers = 0\n        self._closing = False\n        self._pool_full_warned = False\n        self._stop_recycler = threading.Event()\n        self._pool_error: BaseException | None = None\n        self._closed = False\n","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/utils/cuda_vmm_transport_utils.py#L164-L200","documentation":"Constructor guard on the CUDA VMM shared pool: memory_size must be > 0. Zero/negative sizes are rejected before any driver allocation is attempted.","triggerScenarios":"Instantiating the VMM pool with memory_size=0 or negative — usually derived from a computed size (e.g. per-consumer bytes * consumer_count) that underflowed or a config value of 0.","commonSituations":"Misconfigured multimodal transport memory settings, integer underflow in size math, or a default of 0 leaking from config parsing.","solutions":["Compute and log memory_size before constructing; fix the sizing formula/config","Ensure consumer_count and per-consumer bytes are positive integers","Set a sane minimum (>= CUDA allocation granularity, see 6377)"],"exampleFix":"# before\npool = CudaVmmTransportPool(memory_size=0, ...)\n# after\npool = CudaVmmTransportPool(memory_size=512 * 1024 * 1024, ...)","handlingStrategy":"validation","validationCode":"if memory_size <= 0:\n    raise ConfigError(f\"memory_size={memory_size}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate derived sizes before constructing the pool","Unit-test size formulas with small configs"],"tags":["cuda","vmm","validation","constructor"],"backgroundTag":"invalid-configuration-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}