Celery 3.0.1 中的框架错误

2022-01-11 00:00:00 python django celery rabbitmq

问题描述

我最近从 2.3.0 升级到 Celery 3.0.1,所有任务都运行良好.很遗憾.我经常收到框架错误"异常.我也在运行主管来重新启动线程,但由于这些线程从未真正被杀死,主管无法知道需要重新启动芹菜.有人见过这个吗?

I recently upgraded to Celery 3.0.1 from 2.3.0 and all the tasks run fine. Unfortunately. I'm getting a "Framing Error" exception pretty frequently. I'm also running supervisor to restart the threads but since these are never really killed supervisor has no way of knowing that celery needs to be restarted. Has anyone seen this before?

2012-07-13 18:53:59,004: ERROR/MainProcess] Unrecoverable error: Exception('Framing Error, received 0x00 while expecting 0xce',)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery/worker/__init__.py", line 350, in start
    component.start()
  File "/usr/local/lib/python2.7/dist-packages/celery/worker/consumer.py", line 360, in start
    self.consume_messages()
  File "/usr/local/lib/python2.7/dist-packages/celery/worker/consumer.py", line 445, in consume_messages
    drain_nowait()
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 175, in drain_nowait
    self.drain_events(timeout=0)
  File "/usr/local/lib/python2.7/dist-packages/kombu/connection.py", line 171, in drain_events
    return self.transport.drain_events(self.connection, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/amqplib.py", line 262, in drain_events
    return connection.drain_events(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/amqplib.py", line 97, in drain_events
    chanmap, None, timeout=timeout)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/amqplib.py", line 155, in     _wait_multiple
    channel, method_sig, args, content = read_timeout(timeout)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/amqplib.py", line 129, in read_timeout
    return self.method_reader.read_method()
  File "/usr/local/lib/python2.7/dist-packages/amqplib/client_0_8/method_framing.py", line 221, in read_method
    raise m
Exception: Framing Error, received 0x00 while expecting 0xce


解决方案

虽然我不确定为什么会发生这种情况,但从 amqplib 切换到 librabbitmq 帮助我克服了这个麻烦.

While I am not sure why this actually happens, switching from amqplib to librabbitmq helped me to overcome this trouble.

我没有更改任何配置,只是:

I haven't changed anything in configuration, just:

pip uninstall amqplib
pip install librabbitmq

并重新启动芹菜工人.

得到这个想法的形式 https://github.com/celery/celery/issues/922

相关文章