{"record":{"id":"dd47f33b864be2fd","repo":"sgl-project/sglang","slug":"recycle-interval-must-be-positive","errorCode":null,"errorMessage":"recycle_interval must be positive","messagePattern":"recycle_interval must be positive","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/transport/memory_pool.py","lineNumber":178,"sourceCode":"        self,\n        *,\n        memory_size: int,\n        byte_tensor: torch.Tensor,\n        base_address: int,\n        device_id: int,\n        consumer_count: int,\n        recycle_interval: float,\n        transport_name: str,\n        max_inflight_slices: int = DEFAULT_MAX_INFLIGHT_SLICES,\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 max_inflight_slices <= 0:\n            raise ValueError(\"max_inflight_slices must be positive\")\n        if recycle_interval <= 0:\n            raise ValueError(\"recycle_interval must be positive\")\n        if (\n            not byte_tensor.is_cuda\n            or byte_tensor.device.index != device_id\n            or byte_tensor.dtype != torch.uint8\n            or not byte_tensor.is_contiguous()\n            or byte_tensor.numel() < memory_size\n        ):\n            raise ValueError(\n                \"byte_tensor must be a sufficiently large contiguous uint8 tensor \"\n                f\"on cuda:{device_id}\"\n            )\n\n        self.memory_size = memory_size\n        self.byte_tensor = byte_tensor\n        self.base_address = base_address\n        self.device_id = device_id\n        self.consumer_count = consumer_count\n        self.control_words_per_slot = 1 + consumer_count","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/transport/memory_pool.py#L160-L196","documentation":"SharedMemoryPool (multimodal transport memory pool) validates its constructor arguments; recycle_interval controls how often the background recycler thread wakes to reclaim completed leases. A non-positive interval would make the recycler spin or fail to wait, so it is rejected upfront with ValueError.","triggerScenarios":"Constructing SharedMemoryPool (directly or via a transport factory) with recycle_interval=0 or negative, e.g. passing a config value that was never set and defaulted to 0.","commonSituations":"YAML/JSON config missing the recycle interval key so it defaults to 0; unit tests constructing pools with placeholder integers; copy-paste of another pool's kwargs.","solutions":["Set recycle_interval to a positive number of seconds (e.g. 0.1–1.0)","Check the config path feeding this constructor for a missing/zeroed recycle_interval field","If a shorter/longer cadence is desired, tune the positive value rather than zeroing it"],"exampleFix":"// before\npool = SharedMemoryPool(..., recycle_interval=0)\n// after\npool = SharedMemoryPool(..., recycle_interval=0.5)","handlingStrategy":"validation","validationCode":"assert isinstance(recycle_interval, (int, float)) and recycle_interval > 0, 'recycle_interval must be > 0'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate pool config values centrally before constructing SharedMemoryPool","Fail fast in config loading when optional numeric fields are absent instead of defaulting to 0"],"tags":["multimodal","memory-pool","argument-validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}