Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ubuntu16.04使用Celery+RabbitMQ+redis运行出错 #48

Closed
sison-yuan opened this issue Jan 24, 2017 · 5 comments
Closed

ubuntu16.04使用Celery+RabbitMQ+redis运行出错 #48

sison-yuan opened this issue Jan 24, 2017 · 5 comments

Comments

@sison-yuan
Copy link

sison-yuan commented Jan 24, 2017

[2017-01-24 14:30:30,628: WARNING/MainProcess] Received and deleted unknown message.  Wrong destination?!?

The full contents of the message body was: body: [[1, 3], {}, {u'errbacks': None, u'callbacks': None, u'chord': None, u'chain': None}] (41b)
{content_type:'application/x-msgpack' content_encoding:'binary'
  delivery_info:{'consumer_tag': 'None4', 'redelivered': False, 'routing_key': 'celery', 'delivery_tag': 2L, 'exchange': ''} headers={'\xe5\xca.\xdb\x00\x00\x00\x00\x00': None, 'P&5\x07\x00': None, 'T\nKB\x00\x00\x00': 'f638042a-d652-48ef-98bc-8680ee4e1d70', 'N\xfd\x17=\x00\x00': 'gen5561@yuan-CP65S', '\xcfb\xddR': 'py', '9*\xa8': None, '\xb7/b\x84\x00\x00\x00': 0, '\xe0\x0b\xfa\x89\x00\x00\x00': None, '\xdfR\xc4x\x00\x00\x00\x00\x00': [None, None], 'T3\x1d ': 'proj.tasks.add', '\xae\xbf': 'f638042a-d652-48ef-98bc-8680ee4e1d70', '\x11s\x1f\xd8\x00\x00\x00\x00': '(1, 3)', 'UL\xa1\xfc\x00\x00\x00\x00\x00\x00': '{}'}}

我是直接clone的代码,运行也出这个问题
经测试,消息代理使用rabbitmq的时候就会出现这个情况,使用redis的话没有问题,rabbitmq与celery的安装均是按照书上P253, P258, P265安装配置的,其他没有设置

@sison-yuan
Copy link
Author

经过今天测试,发现问题出在librabbitmq这个库上面,pip卸载掉这个库就可以运行了,但作者书上写务必使用这个C写的库,求解是否有解决方法?

@dongweiming
Copy link
Owner

@escblack 我写书时各个软件的版本正常的,但是不能保证半年后的现在不会做什么不兼容的修改。 我搜了下 https://github.com/celery/celery/search?q=Received+and+deleted+unknown+message&type=Issues&utf8=%E2%9C%93 还挺多的,你可以参考下

@dongweiming
Copy link
Owner

代码是消息的格式有问题,没有task这个头信息。

@maxbitcoin
Copy link

maxbitcoin commented Feb 8, 2017

这里有解决办法-> celery/celery#3689

方法一:
配置文件celeryconfig.py加上这一行
CELERY_TASK_PROTOCOL = 1

方法二:
app = Celery()
app.conf.task_protocol = 1

董大写书时用的是celery v3.1.18,现在celery升级到了4.0,应该是老版本的librabbitmq与最新的celery4.0 Message Protocol协议不兼容造成的(点这里) ,celery4.0默认使用Task messages Version 2 ,而librabbitmq使用Task messages Version 1

@dongweiming
Copy link
Owner

@maxbitcoin 感谢 书的下一版我加上这部分说明

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants