Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to diagnose Celery workers that hang

I am getting started with Celery for a Django project. For local development purposes I've set it up with djcelery and djkombu (database transport), according to these instructiuons http://ask.github.com/celery/tutorials/otherqueues.html#django-database but plan on using rabbitmq on the production server.

I've found that it works but that one or more of the workers will hang at random. The workers hang on different tasks, so it's not a case that one particular task is entering an infinite loop. When I try to shut down celery, in the log I usually see all the workers exiting except for one. Both before and after a worker hangs, I've tried using celeryctl to get information about the workers, but celeryctl always fails with a message "Error: No nodes replied within time constraint. ". I've also tried inspecting workers http://docs.celeryproject.org/en/latest/userguide/workers.html#inspecting-workers but all of the methods return nothing.

Any ideas about how to diagnose what's causing the worker to hang or would be helpful.

like image 958
LS55321 Avatar asked Jun 27 '11 14:06

LS55321


People also ask

What is worker in celery?

Celery Worker is the one which is going to run the tasks. celery -A tasks worker --pool=prefork --concurrency=1 --loglevel=info. Above is the command to start the worker.

What is concurrency in celery?

As for --concurrency celery by default uses multiprocessing to perform concurrent execution of tasks. The number of worker processes/threads can be changed using the --concurrency argument and defaults to the number of available CPU's if not set.

What is soft time limit in celery?

Celery worker is set to timeout after 10 seconds with soft timeout of 5 seconds. A delay is introduced to the celery task in order to cause a timeout. The timeout Exception is never raised by Celery worker.


1 Answers

I was having the same problem. I think this is because you're using ghettoq which does not support events.

According to ask:

remote control commands (broadcast) and events does not work with ghettoq.

like image 108
Evan R. Avatar answered Sep 22 '22 07:09

Evan R.