SGLang KV Pool Full & Waiting Queue Buildup Triage
Diagnose SGLang TokenToKVPool exhaustion and rising waiting queue requests with RadixAttention Prometheus metrics, eviction checks, and concurrency caps.
Rising SGLang #queue-req counts with KV pool saturation mean active running requests hold more KV blocks than eviction can reclaim, or aborted/disconnected streaming requests are leaking or delaying block release. Inspect SGLang /metrics (sglang:token_usage, sglang:num_running_reqs, sglang:num_queue_reqs), test bounded --max-running-requests, and verify client abort propagation in your SGLang release.
- Symptom
[2026-11-25 11:42:18 TP0] File "/sgl-workspace/sglang/python/sglang/srt/managers/scheduler.py", line 1428, in get_new_batch_prefill [2026-11-25 11:42:18 TP0] #running-req: 48, #token: 192410, token usage: 0.98, #queue-req: 134 [2026-11-25 11:42:19 TP0] WARNING: TokenToKVPool is full (available_blocks=0, requested=1640); retracting running request req_id=8f12c9a0 due to insufficient KV cache capacity RuntimeError: SGLang scheduler queue exhausted KV cache blocks after retracting 6 running requests- Root cause
- Pinned KV tokens from active or non-aborted streaming requests exhausted TokenToKVPool capacity and stalled queue admission.
- Recommended fix
- Scrape /metrics on the SGLang endpoint and watch sglang:token_usage, sglang:num_running_reqs, sglang:num_queue_reqs, and sglang:cache_hit_rate during load and immediately after a client cancellation test.
- How Denpex helps
- Denpex investigates SGLang KV Pool Full & Waiting Queue Buildup Triage using the evidence you provide or your connected workload collects. Earlier rank, host or application evidence is needed to distinguish an initiating failure from a downstream report.
What this failure is
A scheduler backpressure and KV-pool exhaustion state in sglang.srt where new requests wait in queue because TokenToKVPool has insufficient reclaimable blocks.
Is this what broke your run? Paste your log.
You're reading about SGLang KV Pool Full & Waiting Queue Buildup Triage. Paste your own traceback and relevant evidence for an investigation of your workload, with a next action or a specific missing fact. A reference entry does not establish your cause. No account or card for the free diagnosis. Review data handling before submitting sensitive logs.
Before uploading, review cloud data handling and local options.
Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.
Why it happens (the mechanism)
RadixAttention keeps prefix tree nodes evictable until active running requests pin blocks. Long-context concurrent waves, missing streaming disconnect abort propagation in reverse proxies, or too small a --mem-fraction-static pool can drive token usage near 100% and leave #queue-req growing.
What you'll observe
- SGLang latency spikes while #queue-req climbs steadily and new requests time out
- TokenToKVPool warnings repeat after clients disconnect mid-stream or under concurrent long prompts
Common symptoms and what they mean
Check possible explanations against the incident evidence. A matching symptom alone does not establish its cause.
| Symptom | Possible explanation |
|---|---|
| TokenToKVPool is full or KV cache pool retracted requests repeatedly in sglang scheduler logs | Pinned KV tokens from active or non-aborted streaming requests exhausted TokenToKVPool capacity and stalled queue admission. |
| sglang:token_usage approaches 1.0 while sglang:num_queue_reqs increases without draining | Pinned KV tokens from active or non-aborted streaming requests exhausted TokenToKVPool capacity and stalled queue admission. |
Which systems are affected
- SGLang serving deployments handling long-context streaming workloads
- Multi-replica gateways behind NGINX or Envoy proxies that buffer client disconnects
How to confirm this is the problem
Use this checklist to test the hypothesis against a small reproduction. No single line proves the root cause, so preserve the preceding events and compare one variable at a time.
- ✓Verify sglang:num_running_reqs returns to 0 and token_usage releases cleanly within seconds of closing an active streaming client connection.
Root cause
- Pinned KV tokens from active or non-aborted streaming requests exhausted TokenToKVPool capacity and stalled queue admission.
The fix and how to prevent it
How to fix it
- Scrape /metrics on the SGLang endpoint and watch sglang:token_usage, sglang:num_running_reqs, sglang:num_queue_reqs, and sglang:cache_hit_rate during load and immediately after a client cancellation test.
- Check whether token_usage stays elevated and num_running_reqs fails to drop after cancelling a long streaming HTTP request; ensure proxy disconnect propagation reaches SGLang instead of hanging until max_tokens.
- Cap admission bursts with --max-running-requests and --chunked-prefill-size, or increase --mem-fraction-static only if CUDA graph and activation OOM headroom remain safe.
- Upgrade SGLang if testing reproduces delayed abort cleanup of disconnected streaming requests on your pinned build.
Step-by-step remediation
- 1Launch with --enable-metrics and inspect sglang:token_usage, num_running_reqs, and num_queue_reqs.
- 2Start a long generation stream, cancel it midway at the proxy, and confirm running request count drops promptly.
- 3Adjust --max-running-requests and proxy timeouts so pinned KV tokens stay below pool exhaustion.
How to prevent it
- Alert when sglang:num_queue_reqs rises concurrently with sglang:token_usage > 0.90
- Validate reverse-proxy cancellation forwarding with a controlled streaming abort test before launch
Save this diagnosis and catch the next crash automatically
All root cause, fix, and prevention steps above are free to read. Create a free account with any email or GitHub to keep your saved diagnosis history across the encyclopedia and run cloud checks, or use a work email below for the 30-day Team evaluation. No card required.
Or start a 30-day free Team trial (work email)
Verified work email unlocks all 14 fleet diagnostic tools, Slack alerts, and team history for 30 days. No card and no automatic charge.
Searchable error signature
[2026-11-25 11:42:18 TP0] File "/sgl-workspace/sglang/python/sglang/srt/managers/scheduler.py", line 1428, in get_new_batch_prefill
[2026-11-25 11:42:18 TP0] #running-req: 48, #token: 192410, token usage: 0.98, #queue-req: 134
[2026-11-25 11:42:19 TP0] WARNING: TokenToKVPool is full (available_blocks=0, requested=1640); retracting running request req_id=8f12c9a0 due to insufficient KV cache capacity
RuntimeError: SGLang scheduler queue exhausted KV cache blocks after retracting 6 running requestsUse this text as a lookup key in logs and upstream issue trackers. It is not presented as a captured customer log. Confirm the cause from your own preceding events, versions, configuration and the cited references.
Diagnose your own log automatically
The root cause and fix steps above stay free. Create a free account to analyze full job logs, attribute the first failed rank, and keep saved incident history.
Sign up free. Analyze your cluster logsNo credit card. Daily allowance follows verified trust tier. Instant access.
Why the recommended fix works
Checking Prometheus metrics during a controlled stream abort isolates proxy/server cancellation leaks from simple concurrency oversubscription.
Code examples
curl -s http://127.0.0.1:30000/metrics | grep -E 'sglang:(token_usage|num_running_reqs|num_queue_reqs|cache_hit_rate)'
python3 -m sglang.launch_server --model-path YOUR_MODEL --enable-metrics --max-running-requests 48 --chunked-prefill-size 8192This snippet illustrates the entry-specific check. Verify the installed versions, permissions, target and workload context before using it. A command or API example is not proof of recovery.
Best practices by model family
| Model / Stack | Recommendation | Notes |
|---|---|---|
| Queue buildup + token_usage ~ 1.0 | Test client stream cancel and inspect num_running_reqs | Separates zombie streaming requests from true traffic overload. |
| Healthy cancel, high demand | Tune --max-running-requests and --chunked-prefill-size | Bounds active pinned tokens cleanly. |
With the fix vs without the fix
| Dimension | With the fix | Without the fix |
|---|---|---|
| Proxy streaming setup | Client abort propagated immediately to SGLang backend | Cancelled streams finish full generation while holding KV blocks |
| Metrics tracking | Watch token_usage alongside num_queue_reqs | Diagnosing queue timeouts blind from HTTP 504 gateway logs |
Diagnostic note
“In RadixAttention, cached prefix trees automatically evict when unused, so persistent token_usage saturation paired with growing #queue-req specifically indicates active pinned blocks (either too high running concurrency or uncancelled client streams).”
Diagnose this failure in VS Code
Select the traceback or open the failed terminal, then run Denpex locally to inspect matched failure patterns, supporting evidence and next checks without uploading the log. Verify recommendations against your workload before changing production.
Install the free VS Code extensionSGLang errors in context
SGLang failures cross RadixAttention cache pools, FlashInfer kernels, and worker timeouts.
Compare related sglang errorsFrequently asked questions
Questions engineers and on-call staff commonly ask about this failure.
Does prefix caching prevent RadixAttention from freeing memory for new requests?
Should I immediately raise --mem-fraction-static to fix TokenToKVPool warnings?
Don't just read the fix, diagnose your run
The encyclopedia explains documented failure patterns. Denpex investigates your logs, configuration and stack, shows the supporting evidence, and asks for missing details when needed.
Related Inference errors
DeepGEMM rejects FP8 block-scaled weights with Unknown SF transformation on an unsupported architecture
Inference · high
SGLang NCCL Error and Multi-Node Timeout
Inference · high
SGLang torch.OutOfMemoryError: CUDA out of memory
Inference · high
vLLM NCCL P2P Hang and Timeout in Tensor Parallelism
Inference · high