Repository navigation
Conversation
…histogram process_request sets request_status = "success" before contacting the backend and changes it only in `except Exception`. A client disconnect reaches the generator as GeneratorExit or asyncio.CancelledError. Both are BaseException, so a response abandoned mid-stream was still observed in vllm:request_latency_seconds with status="success". Mark such terminations "aborted" and re-raise. The finally block still releases the in-flight slot as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EkWp1KKx8oCX8JA3mXdkVJ Signed-off-by: Mazyad Alabduljaleel <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request ensures that abandoned responses due to client disconnections are correctly recorded as 'aborted' by catching BaseException and setting the request status accordingly. It also adds a test case to verify this behavior. The review feedback suggests adding the @pytest.mark.asyncio decorator to the new asynchronous test to ensure it runs correctly.
| assert after_out - before_out == 22 | ||
|
|
||
|
|
||
| async def test_abandoned_response_is_recorded_as_aborted(monitor): |
There was a problem hiding this comment.
The async test function test_abandoned_response_is_recorded_as_aborted is missing the @pytest.mark.asyncio decorator. Without this decorator, pytest may not execute it as an asynchronous test, or it might fail depending on the pytest-asyncio configuration. Adding the decorator ensures consistency with the other async tests in this file.
| async def test_abandoned_response_is_recorded_as_aborted(monitor): | |
| @pytest.mark.asyncio | |
| async def test_abandoned_response_is_recorded_as_aborted(monitor): |
There was a problem hiding this comment.
Applied in 3b3d56d, to match the other async tests in this file. (asyncio_mode = "auto" already ran it, so the result is unchanged.)
Address review feedback: match the other async tests in this file. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EkWp1KKx8oCX8JA3mXdkVJ Signed-off-by: Mazyad Alabduljaleel <[email protected]>
FIX #1231
A client disconnect reaches
process_requestasGeneratorExitorasyncio.CancelledError. Neither is anException, sorequest_statusstayed"success"and abandoned requests were recorded invllm:request_latency_secondsas successes. This PR marks them"aborted"and re-raises; thefinallyblock is unchanged.Testing:
test_abandoned_response_is_recorded_as_abortedreads the headers and the first chunk, then closes the generator. It fails on main (status="success"is counted) and passes with this change.-swhen doinggit commit[Bugfix],[Feat], and[CI].🤖 Generated with Claude Code
https://claude.ai/code/session_01EkWp1KKx8oCX8JA3mXdkVJ