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

WebSocket frozen in SSL after receiving message bigger than MTU #48

Closed
martinayotte opened this issue Jan 31, 2017 · 1 comment
Closed

Comments

@martinayotte
Copy link

martinayotte commented Jan 31, 2017

Using the client from https://github.com/websocket-client/websocket-client, and tweaking it so that it send 100 big messages bigger then usual MTU of 1500 bytes, and disabling the SSL certificate check with "sslopt={"cert_reqs": ssl.CERT_NONE, "check_hostname": False}", than running the SimpleExampleServer.py with added debug print in SimpleEcho/handleMessage(), we can see that after awhile, it stop receiving the messages, therefore never echo the remaining ones, sometime only after 9-10 messages, sometimes after 30 or more, but never succeed to 100 messages.

This symptom doesn't seems to happen in Non-SSL.

And also, just to make sure it wasn't a bug of the websocket-client, this one as been tested with wss://echo.websocket.org/ several hundreds times, and didn't get any issue.

I'm not familiar with the low level websocket handshaking, so I didn't figured out where to add some traces to narrow the issue.
Could you provide some help ?

@dpallot
Copy link
Owner

dpallot commented Feb 10, 2017

This is a good pickup.
With an SSL socket the entire packet/record has to be read in a select environment. If you only do a partial read then select will not notify the application that data is left to be read. The simplest solution is to recv up to the max size of the SSL record which is 16k (16384). I will make that change.

I've tested it and works ok. I've checked in the change, let me know how you go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants