You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Non-streaming requests keep decoding after the client disconnects #644
Only stream_with_cancellation (server/api_server.py:361) checks for a client disconnect. The non-streaming paths of chat completions, completions, /v1/messages and /v1/responses await the result without watching the connection, so an abandoned request keeps its slot until max_tokens.
Adding a poll there would not be enough: _record_request_middleware (api_server.py:449) is a BaseHTTPMiddleware, and under it request.is_disconnected() stays False while a non-streaming handler runs. A probe route on main's app that polls is_disconnected() never sees a client that closed its socket. With only that middleware removed from app.user_middleware, it does.
Expected: a disconnect aborts a non-streaming request, as it does a streaming one; for example, make the recorder a pure ASGI middleware and watch the connection while awaiting the result.
Tested in the 1080 Ti deployment branch, rebuilt today on main 9c635a1 (torch 2.14.1+cu126, Triton 3.8, GTX 1080 Ti sm_61, Qwen3.8-Flash-Next-NVFP4 at 262K): main now wraps /v1/messages and /v1/responses in the disconnect watcher; the branch adds the n>1 abort test and the pure-ASGI request recorder. tests/server/test_stream_cancellation.py and tests/server/test_request_recorder_disconnect.py pass.
Activity
gdevenyi commentedon Oct 13, 2026
Tested in the 1080 Ti deployment branch, rebuilt today on main 9c635a1 (torch 2.14.1+cu126, Triton 3.8, GTX 1080 Ti sm_61, Qwen3.8-Flash-Next-NVFP4 at 262K): main now wraps
/v1/messagesand/v1/responsesin the disconnect watcher; the branch adds the n>1 abort test and the pure-ASGI request recorder.tests/server/test_stream_cancellation.pyandtests/server/test_request_recorder_disconnect.pypass.