-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Serve] Improve handling the websocket server disconnect scenario #42130
[Serve] Improve handling the websocket server disconnect scenario #42130
Conversation
Signed-off-by: Sihan Wang <sihanwang41@gmail.com>
python/ray/serve/_private/proxy.py
Outdated
# If the server disconnects, status_code can be set above from the | ||
# disconnect message. but it is not guaranteed. | ||
# If client disconnects, the disconnect code comes from | ||
# a client message via the receive interface, but is is not guaranteed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix grammar and punctuation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find.
- Have you manually confirmed that it fixes the issue in the test?
- Any automated testing that can/should be added here?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this case and added test coverage, Sihan!
@@ -547,6 +550,66 @@ async def test_proxy_asgi_receive(self): | |||
|
|||
queue.close.assert_called_once() | |||
|
|||
@pytest.mark.asyncio | |||
@pytest.mark.parametrize( | |||
"disconnect", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick (non-blocker): We can probably refactor this to pass a tuple of received messages and expected messages so we don't need to do have the if-else statement below. Just an idea, no strong feeling either way.
…y-project#42130) Server disconnect message is not guaranteed to be sent. So we need to handle it when finish the websocket connection. --------- Signed-off-by: Sihan Wang <sihanwang41@gmail.com>
…y-project#42130) Server disconnect message is not guaranteed to be sent. So we need to handle it when finish the websocket connection. --------- Signed-off-by: Sihan Wang <sihanwang41@gmail.com>
Why are these changes needed?
Server disconnect message is not guaranteed to be sent. So we need to handle it when finish the websocket connection.
Related issue number
Closes: #42124
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.