Open
Conversation
|
Will this get investigated? If I run |
This was referenced Nov 1, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Test/Question/Other
PR Checklist
Overview
This PR emphasises my question regarding proper behavior of
WebSocketclose procedure.It seems like neither receiving close and sending it back to client nor initiating close and receiving it back from client (close handshake) does not cause web socket stream to finish and TCP connection released.
I'm not sure if it's my expectation from API is wrong or there is a bug. But anyway the question is what is the proper way to terminate WebSocket (except
ctx.stop()which seems to terminate connection ungracefully, possibly loosing pending messages)?I've inspected code and it seems like there are some parts which are intended to do some special handling of web socket closure, but this code seems to be never executed. E.g. there is
Message::Closewith single usage acrossactix-webrepo, so it's not created anywhere:actix-web/actix-http/src/ws/dispatcher.rs
Lines 357 to 360 in ff8fd2f
There is also some code within
WebsocketContextFutto markWebSocketas closed, which marks WS as closed whenNoneis read frommessagesqueue:actix-web/actix-web-actors/src/ws.rs
Lines 703 to 710 in ff8fd2f
while there is no possibly to write
Noneto outgoing messages queue:actix-web/actix-web-actors/src/ws.rs
Lines 605 to 638 in ff8fd2f
The only part of close which seems to work as expected is when underlying connection is closed by client app and handled here:
actix-web/actix-web-actors/src/ws.rs
Lines 769 to 784 in ff8fd2f
So maybe maintainers could kindly provide answers to questions I've raised here: