问题
Celery connection breaks when long running task is executed. I am using amqp as broker and redis as backend.
Celery is running on remote host, the command I am using for celery worker is as follows
pipenv run celery worker -A src.celery_app -l info -P gevent --without-mingle --without-heartbeat --without-gossip -Q queue1 -n worker1
The error log is as follows:-
[2020-09-09 14:26:46,820: CRITICAL/MainProcess] Couldn't ack 1, reason:ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)
Traceback (most recent call last):
File "c:\users\g-us01.test\.virtualenvs\celery-z5n-38vt\lib\site-packages\kombu\message.py", line 131, in ack_log_error
self.ack(multiple=multiple)
File "c:\users\g-us01.test\.virtualenvs\celery-z5n-38vt\lib\site-packages\kombu\message.py", line 126, in ack
self.channel.basic_ack(self.delivery_tag, multiple=multiple)
File "c:\users\g-us01.test\.virtualenvs\celery-z5n-38vt\lib\site-packages\amqp\channel.py", line 1394, in basic_ack
spec.Basic.Ack, argsig, (delivery_tag, multiple),
File "c:\users\g-us01.test\.virtualenvs\celery-z5n-38vt\lib\site-packages\amqp\abstract_channel.py", line 59, in send_method
conn.frame_writer(1, self.channel_id, sig, args, content)
File "c:\users\g-us01.test\.virtualenvs\celery-z5n-38vt\lib\site-packages\amqp\method_framing.py", line 189, in write_frame
write(view[:offset])
File "c:\users\g-us01.test\.virtualenvs\celery-z5n-38vt\lib\site-packages\amqp\transport.py", line 305, in write
self._write(s)
File "c:\users\g-us01.test\.virtualenvs\celery-z5n-38vt\lib\site-packages\gevent\_socket3.py", line 534, in sendall
return _socketcommon._sendall(self, data_memory, flags)
File "c:\users\g-us01.test\.virtualenvs\celery-z5n-38vt\lib\site-packages\gevent\_socketcommon.py", line 392, in _sendall
timeleft = __send_chunk(socket, chunk, flags, timeleft, end)
File "c:\users\g-us01.test\.virtualenvs\celery-z5n-38vt\lib\site-packages\gevent\_socketcommon.py", line 321, in __send_chunk
data_sent += socket.send(chunk, flags)
File "c:\users\g-us01.test\.virtualenvs\celery-z5n-38vt\lib\site-packages\gevent\_socket3.py", line 515, in send
return self._sock.send(data, flags)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
Unable to understand why this error is occurring.
来源:https://stackoverflow.com/questions/63811772/celery-worker-connectionreseterror-winerror-10054-an-existing-connection-wa