[GH-ISSUE #1994] Batch slots return HTTP 400 "BGEN: no such free slot" instead of queueing; the affected conversation stays broken #794

Closed
opened 2026-11-04 01:45:55 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @jsilve12 on GitHub (Oct 11, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1994

Title: Batch slots return HTTP 400 "BGEN: no such free slot" instead of queueing; the affected conversation stays broken

Body:

Summary

With --batch 4 (and --batch-groups auto) on a layer split, a request that
arrives when all slots are busy is rejected with HTTP 400 rather than waiting:

[strata] the engine reported an error: BGEN: no such free slot (--batch 4) or a bad max_new
[strata] 400 invalid request: BGEN: no such free slot (--batch 4) or a bad max_new

docs/BATCHING.md says the opposite for this case:

"More requests than slots wait for a free one"

So the documented behaviour is to queue. What we observe is a hard 400.

Why this matters

A 400 is not retryable from the client's point of view, and in our run the
affected conversation did not recover: every subsequent turn from that stream
returned the same error immediately (0 tokens, ~0.1 s). One rejection
permanently killed that stream for the rest of the session.

Reproduction

4 concurrent HTTP clients, each holding a growing conversation (5 turns each),
against the lane while normal traffic is also in flight:

  • 4 streams x 5 turns = 20 requests
  • 19 succeeded, 1 stream died at turn 3 with the error above and never recovered
  • turns 4 and 5 of that stream: got: EMPTY, finish: ERROR:{'type': 'invalid_request_error', 'message': 'BGEN: no such "

Each turn appends to the conversation, so prompts grow ~12k tokens per turn
(13.7k -> 25.8k -> 37.8k -> 49.9k -> 62.0k).

The conversation cache was working for the other streams
(reused climbing 13,663 -> 25,770 -> 37,834 -> 49,883), so this is not a
cache miss - it looks like slot exhaustion.

Environment

  • engine 0.1.42
  • 2x NVIDIA CMP 170HX (GA100, sm_80), 64 GB each, layer split 24, --trim-stage-weights
  • --batch 4 --batch-groups auto --expert-cache 30000 --prefill auto:32768
  • --spec 4 --mtp ... --max-context 262144 --kv fp16 --kv-resident 4194304
  • --conversation-cache-mib 16384 --conversation-cache-slots 8
  • /v1/status reported concurrency: {"serving": 4, "requested": 4}
  • /metrics at the time showed live.slots all idle and waiting: 1, outside_slots: 2

What I think should happen

A request that cannot get a slot should wait (as documented), or at minimum
return a retryable status (503 + Retry-After) rather than 400 - and a
conversation that was rejected should be able to retry successfully on its next
turn rather than being permanently broken.

  • #1604 (--batch-groups disables the per-slot conversation cache)
  • #1118 (batch slots stall when a long prompt is read while another slot decodes)

Happy to run any instrumentation you want - /metrics is very informative and I
can capture slot occupancy over time if that helps.

Originally created by @jsilve12 on GitHub (Oct 11, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/1994 Title: Batch slots return HTTP 400 "BGEN: no such free slot" instead of queueing; the affected conversation stays broken Body: ## Summary With `--batch 4` (and `--batch-groups auto`) on a layer split, a request that arrives when all slots are busy is rejected with HTTP 400 rather than waiting: ``` [strata] the engine reported an error: BGEN: no such free slot (--batch 4) or a bad max_new [strata] 400 invalid request: BGEN: no such free slot (--batch 4) or a bad max_new ``` docs/BATCHING.md says the opposite for this case: > "**More requests than slots** wait for a free one" So the documented behaviour is to queue. What we observe is a hard 400. ## Why this matters A 400 is not retryable from the client's point of view, and in our run the affected conversation did not recover: every subsequent turn from that stream returned the same error immediately (0 tokens, ~0.1 s). One rejection permanently killed that stream for the rest of the session. ## Reproduction 4 concurrent HTTP clients, each holding a growing conversation (5 turns each), against the lane while normal traffic is also in flight: - 4 streams x 5 turns = 20 requests - 19 succeeded, 1 stream died at turn 3 with the error above and never recovered - turns 4 and 5 of that stream: `got: EMPTY`, `finish: ERROR:{'type': 'invalid_request_error', 'message': 'BGEN: no such "` Each turn appends to the conversation, so prompts grow ~12k tokens per turn (13.7k -> 25.8k -> 37.8k -> 49.9k -> 62.0k). The conversation cache was working for the other streams (`reused` climbing 13,663 -> 25,770 -> 37,834 -> 49,883), so this is not a cache miss - it looks like slot exhaustion. ## Environment - engine 0.1.42 - 2x NVIDIA CMP 170HX (GA100, sm_80), 64 GB each, layer split 24, `--trim-stage-weights` - `--batch 4 --batch-groups auto --expert-cache 30000 --prefill auto:32768` - `--spec 4 --mtp ... --max-context 262144 --kv fp16 --kv-resident 4194304` - `--conversation-cache-mib 16384 --conversation-cache-slots 8` - `/v1/status` reported `concurrency: {"serving": 4, "requested": 4}` - `/metrics` at the time showed `live.slots` all idle and `waiting: 1`, `outside_slots: 2` ## What I think should happen A request that cannot get a slot should wait (as documented), or at minimum return a retryable status (503 + Retry-After) rather than 400 - and a conversation that was rejected should be able to retry successfully on its next turn rather than being permanently broken. ## Possibly related - #1604 (`--batch-groups` disables the per-slot conversation cache) - #1118 (batch slots stall when a long prompt is read while another slot decodes) Happy to run any instrumentation you want - `/metrics` is very informative and I can capture slot occupancy over time if that helps.
Author
Owner

@Niko1221 commented on GitHub (Oct 12, 2026):

Thank you for the detailed report and the metrics. You are right on both counts: the docs promise that a request waits for a free slot, and a rejected conversation must not stay dead.

What was wrong: the engine refused a BGEN for a slot it still considered occupied while the server believed it free (its own bookkeeping and the engine's view of the slot differed for a moment). The server turned the engine's "ERR BGEN: no such free slot" into an HTTP 400, and because a conversation is drawn back to the slot that holds its prefix, the next turns went to the same slot and got the same refusal. That matches your /metrics (slots idle, waiting 1).

What the fix does: an engine refusal of a slot is no longer a client error. The refused slot is parked for a couple of seconds, the request takes another slot or waits for one, and the conversation's next turn is not affected. If the engine keeps refusing (6 tries) the answer is a 503 with Retry-After instead of a 400, and no slot stays marked busy. It is covered by tests with the fake engine (one refusal retried and answered; permanent refusal gives 503 and frees the slots). It is in 0.1.43.1 (out now).

I could not reproduce the exact engine-side moment where the two views differ, so if it still shows up after the hotfix, the new log line "parallel: the engine refused slot N ... (issue #1994)" plus /metrics at that time would pin it down.

Meanwhile: a client that retries a 400 whose message starts with "BGEN:" after a second or two reaches a free slot; sending the conversation to a fresh slot (changing the first user message slightly) also breaks the pull to the stuck slot.

<!-- gh-comment-id:6129312680 --> @Niko1221 commented on GitHub (Oct 12, 2026): Thank you for the detailed report and the metrics. You are right on both counts: the docs promise that a request waits for a free slot, and a rejected conversation must not stay dead. What was wrong: the engine refused a BGEN for a slot it still considered occupied while the server believed it free (its own bookkeeping and the engine's view of the slot differed for a moment). The server turned the engine's "ERR BGEN: no such free slot" into an HTTP 400, and because a conversation is drawn back to the slot that holds its prefix, the next turns went to the same slot and got the same refusal. That matches your /metrics (slots idle, waiting 1). What the fix does: an engine refusal of a slot is no longer a client error. The refused slot is parked for a couple of seconds, the request takes another slot or waits for one, and the conversation's next turn is not affected. If the engine keeps refusing (6 tries) the answer is a 503 with Retry-After instead of a 400, and no slot stays marked busy. It is covered by tests with the fake engine (one refusal retried and answered; permanent refusal gives 503 and frees the slots). It is in 0.1.43.1 (out now). I could not reproduce the exact engine-side moment where the two views differ, so if it still shows up after the hotfix, the new log line "parallel: the engine refused slot N ... (issue #1994)" plus /metrics at that time would pin it down. Meanwhile: a client that retries a 400 whose message starts with "BGEN:" after a second or two reaches a free slot; sending the conversation to a fresh slot (changing the first user message slightly) also breaks the pull to the stuck slot.
Author
Owner

@Niko1221 commented on GitHub (Oct 19, 2026):

Thanks for the report. This is fixed in 0.2.0-beta (or an earlier release), and we're closing it as part of the tracker reset for 0.2.0-beta.

If it still happens on 0.2.0-beta, add the area prefix to the title ([Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]), put the Strata version and your hardware in the issue form fields, and comment /reopen. A check runs and reopens it.

<!-- gh-comment-id:6270752072 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for the report. This is fixed in 0.2.0-beta (or an earlier release), and we're closing it as part of the tracker reset for 0.2.0-beta. If it still happens on 0.2.0-beta, add the area prefix to the title ([Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]), put the Strata version and your hardware in the issue form fields, and comment `/reopen`. A check runs and reopens it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#794
No description provided.