I run my Django-celery tasks using eventlet. But something is still blocking. I used eventlet's blocking detection and found out that getaddrinfo() is blocking. I read somewhere that I have to install the "dnspython" package, but it makes no difference with or without. It is installed at the moment:
dnspython - A DNS toolkit for Python
INSTALLED: 1.11.0 (latest)
It is also funny that the blocking appears somewhere inside eventlet's code (eventlet.green.socket).
I run celery like that:
/var/www/myproject/async_manage.py celeryd -B \
--schedule=/var/www/myproject/celerybeat-schedule \
--loglevel=INFO -P eventlet -c 1000 \
--settings=myproject.settings.myproject_deployment
My custom async_manage.py (parts of it):
import pymysql
pymysql.install_as_MySQLdb()
import eventlet
import eventlet.debug
os.environ["EVENTLET_NOPATCH"] = 'True'
eventlet.monkey_patch()
eventlet.debug.hub_prevent_multiple_readers(False)
eventlet.debug.hub_blocking_detection(True, 0.1)
if __name__ == "__main__":
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
This is the error I get:
Task myproject.apps.myapp.tasks.mytask with id f8794028-699e-43ba-b48f-3d81b7614f1f raised exception:
'RuntimeError("Blocking detector ALARMED atTraceback(filename=\'/var/www/virtualenvs/myproject/local/lib/python2.7/site-packages/eventlet/green/socket.py\', lineno=43, function=\'create_connection\', code_context=[\' for res in getaddrinfo(host, port, 0, SOCK_STREAM):\\\\n\'], index=0)",)'
Do you have any clue how to fix that? This makes no sense to me.
Thanks in advance, Matthias