python - Celery worker - ConnectionResetError: [WinError 10054] 现有连接被远程主机强行关闭
问题描述
执行长时间运行的任务时,Celery 连接中断。我使用 amqp 作为代理,使用 redis 作为后端。
Celery 在远程主机上运行,我用于 celery worker 的命令如下
pipenv run celery worker -A src.celery_app -l info -P gevent --without-mingle --without-heartbeat --without-gossip -Q queue1 -n worker1
错误日志如下:-
[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
无法理解为什么会发生此错误。
解决方案
推荐阅读
- javascript - 如何使用 FileReader 在 JavaScript 中读取大型视频文件?
- android - 没有高级示例的 NavigationComponents 保留片段状态
- android - Android Calendar Provider 不返回最新数据
- r - R match.call:如何将变量传递给这个函数?
- mysql - SQL 数据库更正
- sql - 如何从主表中进行选择,但使用辅助链接表替换某些行?
- c - 获取指针指向的值
- amazon-s3 - 如何防止云端缓存 307 响应
- java - 如何在使用 OpenWebStart 的 webstart 应用程序中使用 Openjfx
- c - 如何在 C 中识别哪些条目是文件,哪些是目录