Search code examples
pythondjangoubuntuceleryupstart

Upstart job to run Celery doesn't stop all the worker processes


I have written an Upstart job to run celery in my Ubuntu server. Here's my configuration file called celeryd.conf

# celeryd - runs the celery daemon
#
# This task is run on startup to run the celery daemon

description "run celery daemon"

start on startup
expect fork
respawn

exec su - trakklr -c "/app/trakklr/src/trakklr celeryd --events --beat --loglevel=debug --settings=production"

When I execute sudo service celeryd start, the celeryd process starts just fine and all the x number of worker process start fine.

..but when I execute, sudo service celeryd stop, it stops most of the processes but a few processes are left hanging.

Why is this happening? I'm using Celery 2.5.3.


Here's an issue from the Github tracker.

https://github.com/celery/django-celery/issues/142


Solution

  • I wasn't able to figure this out but it seemed to be an issue with my older celery version. I found this issue mentioned on their issue-tracker and I guess it points to the same issue:

    https://github.com/celery/django-celery/issues/142

    I upgraded my celery and django-celery to the 3.x.x versions and this issue was gone.