mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#194
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 @catonooka on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/483
The behavior
A request waiting in the FIFO for its first engine turn sends zero bytes to a streaming client — no SSE events, no keep-alive comments. On
v1.1.27(also present on v1.1.20 where we first measured it),Service.runwraps the initial wait inwith self._turn(hold, cancel):, and_turnonly yieldsNone(a keep-alive) on the fair-slice re-queue path (serve/server.py); the initialfifo.wait_turnloop is silent. Once the turn starts, prompt-progress pings flow fine.With one conversation at a time, any second concurrent request queues for the whole duration of the running turn. A client with a stream-idle timeout then kills the turn while the model is working fine. Same failure class as #403, one layer up.
Measured (v1.1.20-line tree, DeepSeek-V4.1-Flash-1017 EXL3, 2x RTX 3090, one queued stream behind a ~2000-token generation):
streamIdleTimeoutMsto 300000 (5 min) — a long generation or a queue behind several requests crosses it easilyThe fix we run locally (small, tested)
Inline the initial wait the same way the fair-slice re-queue does, yielding
("ping", None)every 50 ms; the SSE layer already writes those as: keep-alivecomment lines:After: 2104 keep-alives over a 105 s queue wait, max silent gap 2.2 s (OpenAI dialect); 1263 keep-alives / 1.9 s max gap on the Anthropic dialect. Answers unchanged; solo / non-stream / thinking paths unregressed.
One trap we hit while making it (worth knowing if you fix it directly): a
yieldinside that wait lands outside thetry:inrun, so a client disconnecting while queued throwsGeneratorExitat the ping yield and leaks the FIFO place and thestatus["queued"]counter — wrap the wait inside the try and give both back in thefinally(our localtest_server.GoneClients(test_a_queued_request_leaves_when_its_client_goes) catches exactly this; it went red the moment we moved the yield out).Full writeup + patch: catonooka/maya-s24-turbo,
dsv41-3090/deepseek-campaign-1024/FIX-queue-heartbeats.mdandpatches/queue-heartbeats.patch(format-patch against v1.1.20-line; the surrounding code has moved a little by v1.1.27 —runnow tracks aqueuedflag in the finally, which covers the counter half of the same leak already).Happy to turn this into a PR against current main if useful.
@mw00 commented on GitHub (Oct 27, 2026):
Thank you for the measurements and for pointing out the GeneratorExit trap. From v1.1.30 a streamed request waiting in the queue for its first turn sends an SSE keep-alive comment (
: keep-alive) every 2 seconds (MAYA_QUEUE_PING_Schanges it), on the OpenAI, Anthropic and Responses streams. Every SSE client ignores these comments, so they only keep idle timeouts from firing. The wait sits inside the request's cleanup, so a client that disconnects while queued still gives its place back; a test covers both.