Skip to content

Instantly share code, notes, and snippets.

@ionelmc
Created December 11, 2012 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ionelmc/4259997 to your computer and use it in GitHub Desktop.
Save ionelmc/4259997 to your computer and use it in GitHub Desktop.
celery bug 1118
from test_app.tasks import stuff, Bubu
import time
import os
while 1:
try:
results = [stuff.apply_async(
args=(Bubu(os.urandom(200000)),),
options={
'queue_name': None,
'exchange': 'C.dq',
'routing_key': file('/etc/hostname').read().strip(),
}
) for i in range(50)]
print results
time.sleep(2)
print [res.revoke(terminate=True) for res in results]
print [res.get(propagate=False) for res in results]
except Exception:
import traceback
traceback.print_exc()
print 'wait 2 secs ...'
time.sleep(2)
BROKER_URL = "amqp://aae:aae@localhost:5672/aae"
CELERY_IMPORTS = "test_app.tasks",
CELERY_TASK_SERIALIZER = "pickle"
CELERYD_MAX_TASKS_PER_CHILD = 1
CELERY_WORKER_DIRECT = True
BROKER_POOL_LIMIT = None
CELERY_RESULT_BACKEND = "mongodb"
CELERY_MONGODB_BACKEND_SETTINGS = {}

In first terminal:

virtualenv ve
ve/bin/pip install -U -I https://github.com/celery/celery/archive/3.0.zip pymongo
MP_LOG=1 ve/bin/celeryd --events --purge --loglevel=DEBUG --concurrency 5

In second terminal:

ve/bin/python bug.py

How to reproduce:

  • run celeryd
  • start bug.py
  • in 3rd terminal restart rabbitmq-server - if you're lucky enough the node will fail after 2-3 restarts
import time
from celery import task
class Bubu(object):
def __init__(self, data):
self.data = data
@task
def stuff(whatev):
time.sleep(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment