What can I do if celery forgets about tasks on a (apparently) random basis?
Question: I have a flask app with sqlalchemy and a celery worker up and running. I use
redis as my broker. Every time someone submits a new message in a
conversation, a worker is started and is supposed to send notification mails
to all people participating in the conversation. Thus it connects to the
database and gets all relevant email addresses.

Unfortunately there seems to be a random factor deciding, whether celery knows
the task that sends mail or not. After some starts it works perfectly
(sometimes), after some starts it does not work at all. The error I get, when
it does not work is:

    
    
    [2012-11-28 21:42:58,751: ERROR/MainProcess] Received unregistered task of type 'messages.sendnotifies'.
     The message has been ignored and discarded.
    
     Did you remember to import the module containing this task?
     Or maybe you are using relative imports?
     Please see http://bit.ly/gLye1c for more information.
    
     The full contents of the message body was:
     {'retries': 0, 'task': 'messages.sendnotifies', 'eta': None, 'args': [41L], 'expires': None, 'callbacks': None, 'errbacks': None, 'kwargs': {}, 'id': '47da3ba7-ec91-4056-bb4f-a6afec2f960f', 'utc': True} (183b)
     Traceback (most recent call last):
       File "/var/www/virtual/venv/lib/python2.7/site-packages/celery/worker/consumer.py", line 410, in on_task_received
         connection = self.connection
     KeyError: 'messages.sendnotifies'
    

When i run celery with `--loglevel=DEBUG` it lists the task in the tasklist
though:

    
    
    [Tasks]
       . celery.backend_cleanup
       . celery.chain
       . celery.chord
       . celery.chord_unlock
       . celery.chunks
       . celery.group
       . celery.map
       . celery.starmap
       . event.notfiy
       . messages.sendnotifies
       . money.checktransaction
       . money.deploypayment
       . money.invoicepromotion
       . protocols.plotweight
       . questionnaire.deploy
       . questionnaire.suitability
       . registration.notify
       . tracking.track
       . user.checkaccount
       . user.checkaccounts
       . user.fixpermissions
       . user.genpassreset
    

I could not determine a system yet, when it works and when not. But I have
upgraded all relevant packages to the latest version available today and it
still does not work.

I am hoping for any ideas on why this might not work and how I might be able
to fix it. Every feedback is very much appreciated, as I am kind of desperate!


Answer: This could be a bug fixed in the current 3.0 development, you could help test
it by installing:

pip install <https://github.com/celery/celery/zipball/3.0>

