question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

took too long to shut down and was killed error

See original GitHub issue

OS: 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:closed
  • Created 2 years ago
  • Reactions:10
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
desteliocommented, Feb 22, 2022

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:

<script src='https://cdnjs.cloudflare.com/ajax/libs/reconnecting-websocket/1.0.0/reconnecting-websocket.js'
></script>

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.

0reactions
carltongibsoncommented, Feb 22, 2022

Hey @destelio — thanks for mentioning that library. It may well be a handy resource to point to…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Django channel Error "took too long to shut down and was ...
This error is broadly because a coroutine is hanging around longer than it should. This specific case.
Read more >
[Answered]-Django channel Error "took too long to shut down ...
Coding example for the question Django channel Error "took too long to shut down and was killed."-django.
Read more >
took too long to shut down and was killed. - Google Groups
... to view the original message. to Django users. Application instance <Task pending name='Task-672596' coro=<ProtocolTypeRouter.
Read more >
Documentation: 15: 19.5. Shutting Down the Server - PostgreSQL
This is the Immediate Shutdown mode. The server will send SIGQUIT to all child processes and wait for them to terminate. If any...
Read more >
Computer Restarts or Shuts Down Intermittently, Locks Up ...
For computer lock ups, there are steps you can take to attempt to ... code that is associated with the shutdown, restart, lockup,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found