Skip to content
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

Server stuck at wait peer, doesn't even disconnect WS #1625

Closed
bitlogik opened this issue Jan 26, 2021 · 2 comments
Closed

Server stuck at wait peer, doesn't even disconnect WS #1625

bitlogik opened this issue Jan 26, 2021 · 2 comments
Assignees
Labels
enhancement Improve functionality, potentially changing behavior
Projects

Comments

@bitlogik
Copy link
Contributor

After the invite_1_claimer_wait_peer command and until the greeter peer connects, the server doesn't disconnect when received WS close frame. This breaks RC6455, the server must send a close frame in response, and immediately close the underlying TCP connection.
It hurts some websocket clients, when the user cancels the claim process at the greeter waiting stage, the application freezes, until a internal timeout after 30 seconds and actually close the connection at the client side.

This is also an issue with the "async" model of the Parsec protocol. The server, in this case retains any response and sends them all with the greeter_public_key message when the greeter connects. The main issue effect is when the claimer cancels and disconnects, as the disconnection is not enforced by the server as it should.

See in the following sequence from a client (green arrow = client sends a message, red arrow = server sends a message back) :
The server needs to send the claimer_wait_peer response with the greeter_public_key in order to respond to any request, including ping and WS disconnect frame.
16:58':35" : client initiates a claim by sending an invite_1_claimer_wait_peer message
That triggers a blocking in the server
16:59':03" : client send a routine ping keepmealive message
16:59':30" : clients sends the next routine ping
16:59':50" : greeter connects and starts the greeting. The server sends the greeter_public_key
It also immediately sends the pong responses. It means there were stuck in the queue, and the server was stuck. We noticed it also ignores any WS disconnect frames, which is the main UX issue.

pingblocked2

@touilleMan touilleMan added the enhancement Improve functionality, potentially changing behavior label Jan 26, 2021
@touilleMan
Copy link
Member

That seems like a valid point ;-)

The issue is currently the backend doesn't keep listening on the client connection once it is dealing with a command (the idea is we consider a command fast enough to process that it's fine to wait for it completion before dealing with the next connection event)

As you discovered, the issue arrived when the command is long lived, which is the case for invite_1_claimer_wait_peer.
The solution would be to use the run_with_breathing_transport function which allow to run the command while still listening to the client connection at the same time. This is what is used for the event_listen command so the client can cancel the listen at any time.

@touilleMan touilleMan added this to New comers in Dev Board via automation Jan 26, 2021
@touilleMan touilleMan moved this from New comers to Ready in Dev Board Jan 27, 2021
@vamonte vamonte self-assigned this Mar 11, 2021
@vamonte vamonte moved this from Ready to Doing in Dev Board Apr 14, 2021
@vamonte vamonte moved this from Doing to Done in Dev Board Apr 22, 2021
@touilleMan
Copy link
Member

fixed by #1666

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve functionality, potentially changing behavior
Projects
No open projects
Dev Board
To review
Development

No branches or pull requests

3 participants