Celery is refusing to deserialize content of type pickle

66 views Asked by At

Recently I upgraded packages celery, amqp, kombu and redis of our Django project to their later versions but for some reason I had to downgrade again. The problem is that after downgrading, celery app is refusing to deserialize content of type pickle.

Steps I have tested are:

  1. First I downgraded packages to their previous versions which worked completely before. But now starting the worker, I face this error:
kombu.exceptions.ContentDisallowed: Refusing to deserialize untrusted content of type pickle (application/x-python-serialize)

Package versions are:

celery==4.4.0
amqp==2.6.1
redis==3.3.7
kombu==4.6.11
  1. I try to upgrade packages (not to latest versions) but this time the worker started but this error occurred:
Refusing to deserialize disabled content of type pickle (application/x-python-serialize)

Package versions are:

celery==5.2.7
amqp==5.1.1
redis==5.0.0
kombu==5.2.4

I know the problem is that it cannot deserialize task to pickle type that is what I want. I tested different settings for my celery app and this is my last version:

accept_content = ["pickle", "json"]
task_serializer = "pickle"
result_backend = 'redis://localhost:6379/2'
broker_url = 'redis://localhost:6379'

I also tested adding result_serializer to celery configs but it did not solve my problem.

I must add that the second error only happens in docker container and when I run celery worker in my computer terminal, there is no error. I use Django===2.2.9. Can anyone help?

0

There are 0 answers