New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Celery pool with Redis broker freeze silently or crash & freeze when hiredis package is installed #3898
Comments
|
I am having a similar issue, but I am using gevent + redis 2.10.5. I did a strace on the stuck celery process and it's looping on this: |
|
We are also seeing this issue on celery 3.1.x and 4.0.x(inclusive master), this is maddening, we already wasted 4 days experimenting with settings, celery versions, we even tried upgrading to celery 4, we tried switching the broker to rabbitmq... Our eventlet workers just decide to idle for several minutes and the process is stuck in a "Resource temporarily unavailable"-loop. We can't switch to prefork as we use several hundred threads per worker process as we are massively I/O (web-api) bound. Currently with RabbitMQ as the message broker and Redis as the result backend (with almost all tasks set to ignore_result=True) as we require near real-time data this is currently fracking our production services... |
|
@AndreCimander If this doesn't work with the RabbitMQ broker as well it sounds like a different issue. The analysis provided here says that using the Redis broker in conjunction with |
|
@canassa Can you please provide more information like the OP did? Does the problem go away when |
|
I've just encountered a similar issue, removing the I do have a few redis connections so it could still be a redis thing. It's definitely driving me crazy... I have no idea how to solve it but it seems something broke it recently for me. |
|
I can confirm this exists for me on Celery 4.2.1, kombu==4.2.1, and hiredis 0.2.0. Removing hiredis "solves" this issue. |
|
celery==4.1.0 |
|
I'm suffering with exactly this problem. In my case |
|
Just to let everybody know: the problem also happens when using |
|
Can anyone here check if this PR (celery/kombu#954) makes the difference? |
|
@popravich I'm deploying that in our testing servers today. In a few hours I can let you know if that worked for us. |
|
@popravich PR on Kombu (celery/kombu#954) fixes the issue in my case. |
|
This problem start to happen again. |
|
redis.exceptions.ResponseError: MOVED 3367 172.31.31.176:6379 Whats the meaning of this exception from redis in aws elasticache for django. settings.py for the ec2 production |
what problem are you facing? can you elaborate more on your setup? |
Hello thanks for your response Any of the above, it works fine in the development environment `-------------- celery@ip-.us-east-2.compute.internal v4.4.7 (cliffs)
[tasks] [2021-03-02 12:38:17,230: CRITICAL/MainProcess] Unrecoverable error: ResponseError('MOVED 14663 172.31.22.150:6379') |
Overview
Celery workers freeze silently or crash and freeze after executing
worker_max_tasks_per_childtasks when using Redis broker and thehiredis(https://github.com/redis/hiredis-py) package is installed.redis-pyis a library used by Celery to connect to Redis broker and ships with two parser classes, the PythonParser and the HiredisParser. By default,redis-pywill attempt to use the HiredisParser if thehiredismodule installed and will fallback to the PythonParser otherwise.Celery is not able to recover from this error and restart broker connection, which is causing permanent deadlock.
Note: this as well may be a problem with
redis-pyandhiredispackages. I'm filling in this issue because it took me some time to reproduce and narrow down the problem (previous report in #2464 (comment)) and I see a couple similar issues reported that may be caused by this conflict rather than contributed by AWS Elastic Beanstalk / AWS ElastiCache Redis setup.Checklist
celery -A proj reportin the issue.(if you are not able to do this, then at least specify the Celery
version affected).
masterbranch of Celery.Environment
requirements.txt)redis(redis-py) package 2.10.5 or8474249(current master)hiredispackage 0.2.0 or5cfdf41(current master)Steps to reproduce
docker-composeto reproduce the exact environment and behaviour. Executemake clean && make run.Expected behavior
Celery pool workers do not freeze or crash when
redis-pyis usinghiredisparser when connecting to Redis broker.Actual behavior
worker_max_tasks_per_childprocessed tasks.worker_max_tasks_per_childprocessed tasks.redis.exceptions.ConnectionError: Error 32 while writing to socket. Broken pipe.worker_max_tasks_per_childprocessed tasks, resumes after broker connection timeout and then crashes after next batch of tasks:BrokenPipeErrorbilliard.exceptions.WorkerLostError: Worker exited prematurely: exitcode 155.redis.exceptions.ConnectionError: Error while reading from socket: ('Connection closed by server.',)redis.exceptions.TimeoutError: Timeout reading from socketredis.exceptions.ConnectionError: Error 32 while writing to socket. Broken pipe.Unrecoverable error: AttributeError("'NoneType' object has no attribute 'fileno'",)Above problems are not observed when
hiredispackage is not present in the system.The text was updated successfully, but these errors were encountered: