celery运行报错:dns.exception.Timeout: The DNS operation timed out after 5.1539998054504395 seconds

 celery运行时报错, 报错如下:

Traceback (most recent call last):
  File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 424, in resolve
    return _proxy.query(name, rdtype, raise_on_no_answer=raises,
  File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 380, in query
    return end()
  File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 359, in end
    raise result[1]
  File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 340, in step
    a = fun(*args, **kwargs)
  File "d:\python_learn\meiduo_project\env\lib\site-packages\dns\resolver.py", line 1089, in query
    return self.resolve(qname, rdtype, rdclass, tcp, source,
  File "d:\python_learn\meiduo_project\env\lib\site-packages\dns\resolver.py", line 1043, in resolve
    timeout = self._compute_timeout(start, lifetime)
  File "d:\python_learn\meiduo_project\env\lib\site-packages\dns\resolver.py", line 950, in _compute_timeout
    raise Timeout(timeout=duration)
dns.exception.Timeout: The DNS operation timed out after 5.1539998054504395 seconds

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\app\trace.py", line 375, in trace_task
    R = retval = fun(*args, **kwargs)
  File "d:\python_learn\meiduo_project\env\lib\site-packages\celery\app\trace.py", line 632, in __protected_call__
    return self.run(*args, **kwargs)
  File "D:\python_learn\meiduo_project\meiduo_mall\celery_tasks\qqemail\tasks.py", line 25, in send_verify_email
    send_mail(subject, '', settings.EMAIL_FROM, [to_email], html_message=html_message)
  File "d:\python_learn\meiduo_project\env\lib\site-packages\django\core\mail\__init__.py", line 62, in send_mail
    return mail.send()
  File "d:\python_learn\meiduo_project\env\lib\site-packages\django\core\mail\message.py", line 348, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "d:\python_learn\meiduo_project\env\lib\site-packages\django\core\mail\backends\smtp.py", line 104, in send_messages
    new_conn_created = self.open()
  File "d:\python_learn\meiduo_project\env\lib\site-packages\django\core\mail\backends\smtp.py", line 64, in open
    self.connection = self.connection_class(self.host, self.port, **connection_params)
  File "D:\Python\Python38\lib\smtplib.py", line 253, in __init__
    (code, msg) = self.connect(host, port)
  File "D:\Python\Python38\lib\smtplib.py", line 339, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "D:\Python\Python38\lib\smtplib.py", line 308, in _get_socket
    return socket.create_connection((host, port), timeout,
  File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\green\socket.py", line 44, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 517, in getaddrinfo
    qname, addrs = _getaddrinfo_lookup(host, family, flags)
  File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 490, in _getaddrinfo_lookup
    raise err
  File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 479, in _getaddrinfo_lookup
    answer = resolve(host, qfamily, False, use_network=use_network)
  File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 432, in resolve
    raise EAI_EAGAIN_ERROR
  File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 479, in _getaddrinfo_lookup
    answer = resolve(host, qfamily, False, use_network=use_network)
  File "d:\python_learn\meiduo_project\env\lib\site-packages\eventlet\support\greendns.py", line 432, in resolve
    raise EAI_EAGAIN_ERROR
socket.gaierror: [Errno 11002] Lookup timed out

可能是版本不兼容问题:换了celery4.4.2后结合

https://www.cnblogs.com/sewen-H/p/13338198.html

celery正常运行

 

posted @ 2020-08-16 15:21  sewen  Views(1419)  Comments(1Edit  收藏  举报