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

uwsgi.websocket_send fails on messages >200-255kb #1602

Open
kylemacfarlane opened this issue Aug 3, 2017 · 7 comments
Open

uwsgi.websocket_send fails on messages >200-255kb #1602

kylemacfarlane opened this issue Aug 3, 2017 · 7 comments

Comments

@kylemacfarlane
Copy link

kylemacfarlane commented Aug 3, 2017

Using uWSGI 2.0.15 and Python 3.5.1.

My WSGI script is a copy of: https://github.com/unbit/uwsgi/blob/2.0.15/tests/websockets_chat_async.py

I run it with:

uwsgi --socket /sockets/dev.websocket.sock --wsgi-file bin/websocket.wsgi --master --single-interpreter --chmod-socket=777 --async 10 --ugreen

When I try to send messages >200-255kb I get the following error:

uwsgi_response_write_body_do() TIMEOUT !!!
Traceback (most recent call last):
  File "/vagrant/src/app/wsgi_websocket.py", line 88, in application
    _handle_output(msg)
  File "/vagrant/src/app/wsgi_websocket.py", line 45, in _handle_output
    uwsgi.websocket_send(json.dumps(msg, separators=(',', ':')))
OSError: unable to send websocket message
  1. This "timeout" happens immediately - not after 60s and is not affected by uwsgi_read_timeout .

  2. The max size that can be sent varies each time uWSGI is started but it always seems to be between 200-255kb.

  3. I've tried increasing options like ugreen-stacksize and websockets-max-size but they have no affect.

@kylemacfarlane
Copy link
Author

This issue doesn't seem to exist if uwsgi is accessed directly by running with --http. This means it must be an nginx setting but I can't figure out what it could be. Adjusting uwsgi_buffers or even completely turning off uwsgi_buffering don't help.

@funkybob
Copy link
Contributor

Does it make any difference if you enable post-buffering ?

@kylemacfarlane
Copy link
Author

Websockets won't even connect when I use --post-buffering.

@lucasdavid
Copy link

Did you manage to fix this? I'm also having this issue.

@kylemacfarlane
Copy link
Author

@lucasdavid I never managed to completely fix it but for me it's pretty rare in production. I think it's something related to #1716 combined with some nginx setting.

@funkybob
Copy link
Contributor

Does it still happen in 2.0.16?

@kylemacfarlane
Copy link
Author

@funkybob I haven't tested 2.0.16 but it was still happening in master from mid-January.

I did find that switching from ugreen to gevent reduced the errors but didn't completely fix it like I claimed in #1716.

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

3 participants