WARNING - server - Application instance took too long to shut down and was killed
See original GitHub issuefirst message is succeed but further messages throw this exception:
2018-08-09 15:25:32,937 - WARNING - server - Application instance <Task pending coro=<__call__() running at /home/soham/PycharmProjects/lead-generation/venv/lib/python3.5/site-packages/channels/sessions.py:175> wait_for=<Future pending cb=[Task._wakeup()]>> for connection <WebSocketProtocol client=['127.0.0.1', 35996] path=b'/lead/'> took too long to shut down and was killed.
My consumer class
class LeadConsumer(AsyncWebsocketConsumer):
async def websocket_connect(self, event):
print("Connected", event)
self.room_group_name = 'lead_list'
# join room group
await self.channel_layer.group_add(
self.room_group_name,
self.channel_name
)
await self.accept()
async def websocket_receive(self, event):
print("Receive", event)
await self.send({
"type": "websocket.send",
"text": "From receive..."
})
async def websocket_disconnect(self, event):
print("Disconnect", event)
await self.send({
"type": "websocket.close"
})
async def lead_list(self, event):
_contact = event['contact']
_campaign = event['campaign']
_company = event['company']
_contact_person = event['contact_person']
await self.send(text_data=json.dumps({
'contact': _contact,
'campaign': _campaign,
'contact_person': _contact_person,
'company': _company
}))
requirements.txt
aioredis==1.1.0
asgiref==2.3.2
async-timeout==2.0.1
attrs==18.1.0
autobahn==18.7.1
Automat==0.7.0
certifi==2018.4.16
channels==2.1.2
channels-redis==2.2.1
chardet==3.0.4
constantly==15.1.0
daphne==2.2.1
diff-match-patch==20121119
Django==2.0.7
django-import-export==1.0.1
django-rest-framework==0.1.0
djangorestframework==3.8.2
docutils==0.14
et-xmlfile==1.0.1
hiredis==0.2.0
hyperlink==18.0.0
idna==2.7
incremental==17.5.0
jdcal==1.4
msgpack==0.5.6
odfpy==1.3.6
openpyxl==2.5.4
PyHamcrest==1.9.0
python-decouple==3.1
pytz==2018.5
PyYAML==3.13
requests==2.19.1
six==1.11.0
tablib==0.12.1
Twisted==18.7.0
txaio==18.7.1
unicodecsv==0.14.1
urllib3==1.23
xlrd==1.1.0
xlwt==1.3.0
zope.interface==4.5.0
How to solve my issue?
Thanks in advance.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:29 (2 by maintainers)
Top Results From Across the Web
django channels Application instance took too long to shut ...
I have a web server uploaded on a server that receives messages from a Windows app and sends them to a front end...
Read more >Anatomy of a Python Memory Leak | Engineering - Paradigm.co
At Paradigm, we need to deliver trading notifications and market data to our customers reliably and with the least latency possible.
Read more >Node Shutdown | CockroachDB Docs
How to drain, decommission, and gracefully shut down a node.
Read more >Shutting Down Logstash - Elastic
What Happens During a Controlled Shutdown?edit · Stop all input, filter and output plugins · Process all in-flight events · Terminate the Logstash...
Read more >Starting and Stopping MySQL :: 3 The Server Shutdown Process
This can occur initiated several ways. For example, a user with the SHUTDOWN privilege can execute a mysqladmin shutdown command. mysqladmin can be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In my particular case it was asgiref==3.3.1 the culprit, i did a rollback to 3.2.10 and it works well ! I have daphne 2.5.0/channels 2.4.0/django 3.0.10/djangorestframework 3.11.1
In my case, the problem was with
redis
.check if there are tcp connections in
CLOSE_WAIT
state.In my case I had around 50+ in such state. Had to update redis.