2012-10-16 119 views
6

芹菜的連接「通過對等連接復位」與錯誤信息定期重置:芹菜錯誤

[Errno 104] Connection reset by peer 

目前,我輸了之後觸發,直到我重置服務器任務和任何東西。我有兩個問題:(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 
+0

「被連接重置」聽起來像是[胡蘿蔔](https://github.com/ask/carrot)是給你的麻煩 – dokkaebi

+0

據我瞭解,胡蘿蔔一直取而代之的是kombu。 kombu可能導致這個問題? – Mike

+0

我遇到了非常類似的設置相同的問題。 –

回答

2

看起來你用完了連接。當你看看CloudAMQP控制檯打開連接你可以驗證它。

也許看看芹菜BROKER_POOL_LIMIT

+0

設置'BROKER_POOL_LIMIT = None'幫助了我。謝謝。 – Stanislav