芹菜错误“对等方重置连接”
Posted
技术标签:
【中文标题】芹菜错误“对等方重置连接”【英文标题】:Celery error 'connection reset by peer' 【发布时间】:2012-10-07 02:06:14 【问题描述】:Celery 的连接会定期重置并显示错误消息:
[Errno 104] Connection reset by peer
目前,在我重置服务器之前,我会丢失任务和之后触发的任何内容。我有 2 个问题:(1)是什么导致了错误/我该如何预防? (2) 如何在错误发生时捕获错误并重试我的任务?
我在 Heroku 上运行。 Celery 配置了 AMQP (CloudAMQP) 作为代理,redis (REDIS_TO_GO) 作为结果后端。
堆栈跟踪:
File "celery/task/trace.py", line 224, in trace_task
R = retval = fun(*args, **kwargs)
File "myapp/tasks.py", line 310, in mytask1
mytask2.delay(message)
File "celery/app/task.py", line 343, in delay
return self.apply_async(args, kwargs)
File "celery/app/task.py", line 458, in apply_async
with app.producer_or_acquire(producer) as P:
File "python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "celery/app/base.py", line 256, in producer_or_acquire
with self.amqp.producer_pool.acquire(block=True) as producer:
File "kombu/connection.py", line 712, in acquire
R = self.prepare(R)
File "kombu/pools.py", line 57, in prepare
p.revive(connection.default_channel)
File "kombu/connection.py", line 626, in default_channel
self._default_channel = self.channel()
File "kombu/connection.py", line 167, in channel
chan = self.transport.create_channel(self.connection)
File "kombu/transport/amqplib.py", line 324, in create_channel
return connection.channel()
File "kombu/transport/amqplib.py", line 243, in channel
return Channel(self, channel_id)
File "kombu/transport/amqplib.py", line 267, in __init__
super(Channel, self).__init__(*args, **kwargs)
File "amqplib/client_0_8/channel.py", line 82, in __init__
self._x_open()
File "amqplib/client_0_8/channel.py", line 469, in _x_open
self._send_method((20, 10), args)
File "amqplib/client_0_8/abstract_channel.py", line 76, in _send_method
method_sig, args, content)
File "amqplib/client_0_8/method_framing.py", line 252, in write_method
self.dest.write_frame(1, channel, payload)
File "amqplib/client_0_8/transport.py", line 165, in write_frame
frame_type, channel, size, payload, 0xce))
File "python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
版本:
Django==1.4.1
django-celery==3.0.9
celery==3.0.9
celery-with-redis==3.0
amqplib==1.0.2
kombu==2.4.7
【问题讨论】:
'connection reset by peer' 听起来 carrot 给你带来了麻烦 据我了解,胡萝卜已被海带取代。 kombu 会导致问题吗? 我遇到了同样的问题,设置非常相似。 【参考方案1】:您的连接似乎用完了。当您查看 CloudAMQP 控制台 打开连接 时,您可以验证它。
也许看看芹菜BROKER_POOL_LIMIT
【讨论】:
设置BROKER_POOL_LIMIT=None
帮助了我。谢谢。以上是关于芹菜错误“对等方重置连接”的主要内容,如果未能解决你的问题,请参考以下文章
http 403 错误 +“readv() 在读取上游时失败(104:对等方重置连接)”