took too long to shut down and was killed error
See original GitHub issueOS: windowns7 django:3.1.8 channels:2.4.0 daphne:2.5.0 asgiref:3.2.10 channels_redis:3.1.0
I flow the channels doc from https://channels.readthedocs.io/ to create a django project with channels.
The I run python manage.py runserver
, and I visit http://localhost:8000
use chrome 90.
The console print some error like:
Application instance <Task pending name='Task-8' coro=<AsgiHandler.__call__() running at D:\Python38\lib\site-packages\channels\http.py:192> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at D:\Python38\lib\asyncio\futures.py:360, <TaskWakeupMethWrapper object at 0x000000002B20F100>()]>> for connection <WebRequest at 0x2b4b2700 method=GET uri=/ clientproto=HTTP/1.1> took too long to shut down and was killed.
And the chrome can not open the address http://localhost:8000
, what I should do to find the hang reason?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:5 (2 by maintainers)
have you tried used the WebSocket reconnect library?
sources: https://github.com/joewalnes/reconnecting-websocket https://www.npmjs.com/package/reconnecting-websocket
you need to add this to your html:
and where you call WebSocket in JavaScript switch from WebSocket to ReconnectingWebSocket
var socket = new ReconnectingWebSocket(endpoint)
refresh your browsers where you monitor messages (and incognito)
and it should work, i faced a similar issue… and this solution works for me.
kudos to justin mitchel, @https://github.com/codingforentrepreneurs for figuring this solution out.
Hey @destelio — thanks for mentioning that library. It may well be a handy resource to point to…