使用redis作为调度中心的celery时启动多个queue,报错Probably the key ('_kombu.binding.reply.celery.pidbox') has been removed from the Redis database
我今天在使用celery启动多个queue时遇到一个问题,当启动第二个queue是,第一个启动的queue日志报了下面一段错误
[2019-12-16 14:40:25,736: ERROR/MainProcess] Control command error: OperationalError("\nCannot route message for exchange 'reply.celery.pidbox': Table empty or key no longer exists.\nProbably the key ('_kombu.binding.reply.celery.pidbox') has been removed from the Redis database.\n") Traceback (most recent call last): File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/connection.py", line 439, in _reraise_as_library_errors yield File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/connection.py", line 518, in _ensured return fun(*args, **kwargs) File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/messaging.py", line 203, in _publish mandatory=mandatory, immediate=immediate, File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/transport/virtual/base.py", line 605, in basic_publish message, exchange, routing_key, **kwargs File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/transport/virtual/exchange.py", line 70, in deliver for queue in _lookup(exchange, routing_key): File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/transport/redis.py", line 877, in _lookup exchange, redis_key)) kombu.exceptions.InconsistencyError: Cannot route message for exchange 'reply.celery.pidbox': Table empty or key no longer exists. Probably the key ('_kombu.binding.reply.celery.pidbox') has been removed from the Redis database. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/celery/worker/pidbox.py", line 46, in on_message self.node.handle_message(body, message) File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/pidbox.py", line 145, in handle_message return self.dispatch(**body) File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/pidbox.py", line 115, in dispatch ticket=ticket) File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/pidbox.py", line 151, in reply serializer=self.mailbox.serializer) File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/pidbox.py", line 285, in _publish_reply **opts File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/messaging.py", line 181, in publish exchange_name, declare, File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/connection.py", line 551, in _ensured errback and errback(exc, 0) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 130, in __exit__ self.gen.throw(type, value, traceback) File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/connection.py", line 444, in _reraise_as_library_errors sys.exc_info()[2]) File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/vine/five.py", line 194, in reraise raise value.with_traceback(tb) File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/connection.py", line 439, in _reraise_as_library_errors yield File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/connection.py", line 518, in _ensured return fun(*args, **kwargs) File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/messaging.py", line 203, in _publish mandatory=mandatory, immediate=immediate, File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/transport/virtual/base.py", line 605, in basic_publish message, exchange, routing_key, **kwargs File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/transport/virtual/exchange.py", line 70, in deliver for queue in _lookup(exchange, routing_key): File "/Users/asher/PycharmProjects/ops_release/venv/lib/python3.7/site-packages/kombu/transport/redis.py", line 877, in _lookup exchange, redis_key)) kombu.exceptions.OperationalError: Cannot route message for exchange 'reply.celery.pidbox': Table empty or key no longer exists. Probably the key ('_kombu.binding.reply.celery.pidbox') has been removed from the Redis database.
经过多方查找,发现这个问题是kombu组件的一个bug,查了一下当前kombu版本发现版本是4.6.5,将版本回退到4.6.4,再启动这个问题就解决了,据说有人需要将版本降到4.6.3,但是我这边不用