sgl-project/sglang · error · ValueError

recycle_interval must be positive

Error message

recycle_interval must be positive

What it means

Constructor guard: recycle_interval must be > 0 — the period for recycling published memory chunks. Zero or negative intervals would spin the recycler hot or break timing math.

Source

Thrown at python/sglang/srt/utils/cuda_vmm_transport_utils.py:186


class CudaVmmMemoryPool:
    """Bounded CUDA VMM pool shared through FABRIC or a local POSIX FD."""

    def __init__(
        self,
        memory_size: int,
        recycle_interval: float,
        base_gpu_id: int,
        consumer_count: int,
        allow_posix_fallback: bool = False,
    ) -> None:
        if memory_size <= 0:
            raise ValueError("memory_size must be positive")
        if consumer_count <= 0:
            raise ValueError("consumer_count must be positive")
        if recycle_interval <= 0:
            raise ValueError("recycle_interval must be positive")

        self.device_index = int(base_gpu_id)
        self.consumer_count = int(consumer_count)
        self._recycle_interval = float(recycle_interval)
        self._lock = threading.Lock()
        self._publisher_condition = threading.Condition(self._lock)
        self._shutdown_lock = threading.Lock()
        self._active_publishers = 0
        self._closing = False
        self._pool_full_warned = False
        self._stop_recycler = threading.Event()
        self._pool_error: BaseException | None = None
        self._closed = False

        self._allocation: VmmReservation | None = None
        self.allocation_size = 0
        self.shareable_handle = None
        self.memory_pool = None

View on GitHub (pinned to 0132848349)

Solutions

  1. Use the documented default or a positive interval (e.g. 1.0 seconds)
  2. Validate server args for this flag at startup
  3. If recycling is unwanted, use the supported disable path rather than interval=0

Example fix

# before
pool = CudaVmmTransportPool(..., recycle_interval=0)
# after
pool = CudaVmmTransportPool(..., recycle_interval=1.0)
Defensive patterns

Strategy: validation

Validate before calling

if not (recycle_interval and recycle_interval > 0):
    raise ConfigError("recycle_interval must be positive")

Prevention

When it happens

Trigger: Passing recycle_interval=0 or a negative float from server args / config.

Common situations: Users setting an aggressive 'no delay' recycle interval of 0 thinking it disables recycling; missing default when constructing the pool manually.

Related errors


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