Celery - task_ids 的冲突
我的任务遇到 HardTimeLimit 异常。经过日志检查后,我发现 -
- celery 未接收任务(任务 id 没有“从代理获取任务:”消息)
- 几天前执行了具有相同 id 的任务。
任务 ID 由 @task 装饰器自动分配,任务由 django 启动,每天大约有 2k 个任务(每天大约有 30 次冲突)。
ID的冲突怎么可能发生?如何预防。
I'm getting HardTimeLimit exception for my tasks. After log examination i found -
- task is not being received by celery ( No "Got task from broker:" message for task id)
- task with the same id was executed couple a days ago.
Task ids are assigned automatically by @task decorator, tasks are started by django, there are ~2k tasks per day ( and ~30 collisions per day).
How ID's collision is possible? How to prevent it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该是不可能的,即使如此,也应该是非常罕见的。我的猜测是,在异常发生后第二次执行相同的任务。也许您的路由键有问题,因为工作人员没有收到任务?或者代理有问题,我见过 RabbitMQ 的有趣问题。删除它的数据库(RABBITMQ_MNESIA_BASE)对我的情况有帮助。
It shouldn't be possible and even if, it should be very rare. My guess would be that the same task is executed a second time after your exception. Maybe there is a problem with your routing keys as the worker doesn't get the task? Or the broker has a problem, I've seen funny problems with RabbitMQ. Deleting it's database (RABBITMQ_MNESIA_BASE) helped in my case.