mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #430] serve: non-streaming request is not cancelled when the client disconnects; the engine runs to max_tokens and blocks the next request #200
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#200
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jkuepker on GitHub (Oct 1, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/430
When a client drops a non-streaming
/v1/chat/completionsrequest (for example, a timeout), the engine keeps going. It reads the whole prompt and generates up tomax_tokens. The next request waits for all of that to finish.Repro:
Observed: the engine log shows the dropped request ran to the end (41,012 tokens read in 30.6 s, then all 300 tokens generated). The small request took 33 s.
Expected: the request is cancelled soon after the disconnect, as streaming requests already are (
finish = "disconnect"). One possible approach: while a non-streaming request runs, poll the client socket for EOF, for example withselectandMSG_PEEKon each heartbeat orPPline, and setcancelwhen it closes.This matters for clients with request timeouts, such as agents and proxies. A timed-out request keeps occupying the single engine.
Environment
@Niko1221 commented on GitHub (Oct 2, 2026):
Fixed in 0.1.34, in the way you suggested: while any request runs, the server checks the client's socket for EOF every 0.5 s (select + MSG_PEEK) and cancels the request, streamed or not, so a timed-out request no longer keeps the engine busy. The same change as #431, with a test for both. Run
START-HERE.bat(Linux:./setup.sh) once to update.