Skip to content

The other serializer

 1 min A Celery event setting failed despite an explicit accept list, and embedding the worker in uWSGI amplified the retry loop.
Published

Dec 13, 2013

My reproducer ran Celery workers inside uWSGI. It selected the solo pool, handed each worker the application function through uWSGI’s simple loop plugin, and made a task available under a stable module name.

The configuration included:

app.conf.CELERY_ACCEPT_CONTENT = ['pickle', 'json']
app.conf.CELERY_EVENT_SERIALIZER = 'pickle'

Despite the accept list, the event path raised ContentDisallowed for pickle. Other errors and repeated attempts made the failure look larger than the setting that triggered it. Removing the event-serializer override stopped the problem in the reproducer.

In Celery issue 1737, Ask Solem identified a hardcoded accept list. The configured task-content policy was not governing the event consumer in the way I expected. He also pointed out that the built-in event fields were already JSON-compatible, so selecting pickle bought nothing for those fields.

The reproducer pins Celery 3.1.6. The worker and supervisor stayed the same; changing the event-serialization option made the failing path work.