-
-
Notifications
You must be signed in to change notification settings - Fork 800
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
AsyncHttpConsumer example from documentation hangs in send_response() #1331
Comments
Sorry, but we can't help out with general support requests here - the issue tracker is for reproduceable bugs and All I can really suggest with the information you've given is to enable Asyncio Debug Mode and see if that reveals your problem. |
@carltongibson |
OK, despite all that, I had a look. The error is that headers must be Change it to this:
The docs here should have this. OR Channels/Daphne should handle it better. |
Thanks! I confirm it fixes the problem. |
Yes! At the least, all examples should pass bytes. Can you make a PR whilst you've got the files open? |
It looks like example in docs is already corrected in master branch: |
Ok, I’ll look at that. Thanks. |
Hi @yuriiz. The docs were not automatically rebuild. I've rebuilt both versions so they now carry the correction. Sorry you ran into that. Thank you for the sample project. I've opened an issue on Daphne for that. django/daphne#276 — Daphne is meant to trigger an informative |
Problem seems to be in |
I've tried running example from https://channels.readthedocs.io/en/latest/topics/consumers.html#asynchttpconsumer but it does not work. It simply hangs up without sending any response body.
I've followed https://channels.readthedocs.io/en/latest/tutorial/index.html exactly step by step. Added
channels
to INSTALLED_APPS, adjusted settings, added routing forhttp
requests only and 1 singleAsyncHTTPConsumer
.Doing verification step from https://channels.readthedocs.io/en/latest/tutorial/part_2.html "Let’s make sure that the channel layer can communicate with Redis..." also was performed successfully.
Example project: https://github.com/yuriiz/myproject/
Steps to reproduce:
In another terminal:
But requests hangs indefinitely. In
runserver
output there is no error message or any other ouput.After adding logging to https://github.com/yuriiz/myproject/blob/master/myproject/consumers.py and retrying only log message before send_response() is shown i.e. send_response() never returns.
Is there anything else which is not mentioned in documentation required to use AsyncHTTPConsumer?
Please also try and include, if you can:
Tried on Ubuntu 19.04, Python3.7 and FreeBSD-11.3, Python3.6 with same result.
pip freeze
output showing your package versionsaioredis==1.2.0
asgiref==3.2.1
asn1crypto==0.24.0
async-timeout==3.0.1
attrs==19.1.0
autobahn==19.8.1
Automat==0.7.0
cffi==1.12.3
channels==2.2.0
channels-redis==2.4.0
constantly==15.1.0
cryptography==2.7
daphne==2.3.0
Django==2.2.4
hiredis==1.0.0
hyperlink==19.0.0
idna==2.8
incremental==17.5.0
msgpack==0.6.1
pkg-resources==0.0.0
pycparser==2.19
PyHamcrest==1.9.0
pytz==2019.2
six==1.12.0
sqlparse==0.3.0
Twisted==19.7.0
txaio==18.8.1
zope.interface==4.6.0
Server should return response. It hang up.
runserver
The text was updated successfully, but these errors were encountered: