Celery: max number of clients reached

Created on 17 Sep 2015  路  3Comments  路  Source: celery/celery

I am using django with celery and redis.
I keep getting this error redis.exceptions:ResponseError max number of clients reached
I am using heroku and my redis backend has max connection of 400. I running 20 dynos for the main app and for celery I am running 5 dynos. How do I set the max number of connections? I've tried putting it in my celery.py like so:

from __future__ import absolute_import

import os

from celery import Celery

# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'imdowntags.settings')

from django.conf import settings

app = Celery('imdowntags',
             broker=os.environ['REDIS_URL'],
             backend=os.environ['REDIS_URL'],
             include=['imdowntags.tasks'])

# Using a string here means the worker will not have to
# pickle the object when using Windows.
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
app.conf.update( CELERY_REDIS_MAX_CONNECTIONS = 20,)

also have tried putting CELERY_REDIS_MAX_CONNECTIONS = 20 inside of my settings.py

Most helpful comment

hi @ask
Has the problem been solved after celery 4.0 release?
I have the same problem by celery-3.1.23 and redis-2.6.
redis default maxclients is 10000 , and after celery run 3 month, redis clients increase to 10000.
I found redis server's connection is full, but celery only has a little connections( by netstat ) , so I restart the redis server, then it works.
but how can I solve the problem by settings or other way?

All 3 comments

Closing this, as we don't have the resources to complete this task.

May be fixed in master, let's see if comes back after 4.0 release.

Some people say BROKER_POOL_LIMIT=0 solves a similar issue: http://stackoverflow.com/questions/12013220/celery-creating-a-new-connection-for-each-task

Can this be related @ask ?

hi @ask
Has the problem been solved after celery 4.0 release?
I have the same problem by celery-3.1.23 and redis-2.6.
redis default maxclients is 10000 , and after celery run 3 month, redis clients increase to 10000.
I found redis server's connection is full, but celery only has a little connections( by netstat ) , so I restart the redis server, then it works.
but how can I solve the problem by settings or other way?

Was this page helpful?
0 / 5 - 0 ratings