-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Closed
Description
Checklist
- I have included the output of
celery -A proj reportin the issue.
(if you are not able to do this, then at least specify the Celery
version affected).
I can reproduce the issue on linux(inside a docker container) or on my own mac.
The celery report goes like this:
software -> celery:4.0.2 (latentcall) kombu:4.0.2 py:3.6.0
billiard:3.5.0.2 py-amqp:2.1.4
platform -> system:Darwin arch:64bit imp:CPython
loader -> celery.loaders.app.AppLoader
settings -> transport:amqp results:disabled
broker_url: 'amqp://guest:********@localhost:5672//'
- I have verified that the issue exists against the
masterbranch of Celery.
Steps to reproduce
Running a simple script with:
from celery import Celery
from some_config import CELERY_BROKER
app = Celery('test_celery', broker='amqp://{user}:{password}@{host}:{port}/{vhost}'.format(**CELERY_BROKER))
class FunkyException(Exception):
def __init__(self, desc=None, extra=None):
super().__init__(desc)
self.extra = extra
@app.task(bind=True)
def eat_memory(self):
try:
raise FunkyException('test', extra=bytearray(512000000))
except Exception as exc:
raise self.retry(exc=exc, countdown=5)
if __name__ == '__main__':
eat_memory.delay()Start celery with gevent:
celery worker -A test_celery:app -P geventThen run the script:
python test_celery.pyExpected behavior
I did't set the max_retries parameter, so the task should be executed after 15 seconds(3 times), and memory should be released after that.
Actual behavior
The memory leaks, and did not release. It might be released after like 5-10 minutes, and sometimes never released.
Actual behavior in my production
The celery worker process leaks slowly. I have to restart the worker every hour.
4.0.x and 4.1.0 are tested with this issue.
wujm2007 and codeadict