{"record":{"id":"995eb94b2c0605e8","repo":"sgl-project/sglang","slug":"consumer-count-must-be-positive-995eb9","errorCode":null,"errorMessage":"consumer_count must be positive","messagePattern":"consumer_count must be positive","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/utils/cuda_vmm_transport_utils.py","lineNumber":184,"sourceCode":"        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\n        self._allocation: VmmReservation | None = None\n        self.allocation_size = 0","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/utils/cuda_vmm_transport_utils.py#L166-L202","documentation":"Constructor guard: consumer_count must be > 0. The pool needs at least one consumer to reserve/publish for; zero means the config is nonsensical.","triggerScenarios":"Passing consumer_count=0 (e.g. derived from an empty consumer list such as zero DP ranks using the transport).","commonSituations":"Degenerate parallelism configs (dp=1, no consumers registered) or a race where the pool is built before consumers register.","solutions":["Pass the true number of consumer ranks/processes","Skip pool creation entirely when there are no consumers","Validate config at parse time, not deep in the constructor"],"exampleFix":"# before\npool = CudaVmmTransportPool(..., consumer_count=len(consumers))  # empty list\n# after\nif consumers:\n    pool = CudaVmmTransportPool(..., consumer_count=len(consumers))","handlingStrategy":"validation","validationCode":"assert isinstance(consumer_count, int) and consumer_count > 0","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Skip pool creation when the consumer list is empty","Validate parallelism config at startup"],"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"}