-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Fix connection linger for WebSTOMP #6789
Fix connection linger for WebSTOMP #6789
Conversation
@csicar Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@csicar Thank you for signing the Contributor License Agreement! |
Thanks! I'll have some small changes to push to your branch / fork. |
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.
The new test fails:
cowboy_websocket_SUITE:sub_non_existent failed on line 192
Reason: {badmatch,{close,{1006,"Connection closed abnormally"}}}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Testing deps.rabbitmq_web_stomp.cowboy_websocket_SUITE: *** FAILED test case 5 of 11 ***
I can reproduce this locally by running this command:
make -C deps/rabbitmq_web_stomp ct-cowboy_websocket t=integration:sub_non_existent
Sometimes the test times out when I run it locally.
I'm looking into it.
That's surprising... |
I took some time to review the code that deals with WebSTOMP. It would be great if this fix could be made to work, because the "correct" (i.e. better use of |
I think I finally found what the problems are. The websocket client
The server sends the correct messages in the correct sequence (which I confirmed with wireshark), but the websocket client does not make it accessible to the test. (Or I'm using it incorrectly) Why the test blocked: Waiting for close(WS, WsReason) ->
WS ! {close, WsReason},
receive
{rfc6455, close, WS, R} ->
{close, R}
end. When the connection is already closed, the client will never receive a Also: There seem to be problems with how the tests are cleaned up: When cancelling a test, some erlang processes remain running (Confirmed by running |
Yeah.. I came to the same conclusion |
1a5e2ed
to
2683762
Compare
- Server closes connection on the error case, so the client was not able to do so and consequently hung - Do not test for the error code returned by the server, because it is not part of the spec and now accessible via the websocket client, which handles the TCP close instead of the Websocket close message
2683762
to
644bf2c
Compare
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.
Thank you!
Fix connection linger for WebSTOMP (backport #6789)
Thanks for merging! |
Proposed Changes
Resolve issue #6737 by delaying closing the websocket connection to happen after the ERROR frame is sent.
Types of Changes
Checklist
CONTRIBUTING.md
documentFurther Comments
Cause of the issue seems to be that
process_request
enqueues an ERROR frame, buthandle_data1
closes the connection immediately. By enqueuing a messageclose_websocket
instead of closing the connection directly, we avoid this problem