Issue 1:
Checklist

I have checked the issues list

for similar or identical bug reports.

I have checked the pull requests list

for existing proposed fixes.

I have checked the commit log

to find out if the bug was already fixed in the master branch.

I have included all related issues and possible duplicate issues in this issue

(If there are none, check this box anyway).

Related Issues and Possible Duplicates

Related Issues

None

Possible Duplicates

None

Description

Suggestions

Issue 2:
Checklist

I have verified that the issue exists against the master branch of Celery.

This has already been asked to the discussion group first.

I have read the relevant section in the

contribution guide

on reporting bugs.

I have checked the issues list

for similar or identical bug reports.

I have checked the pull requests list

for existing proposed fixes.

I have checked the commit log

to find out if the bug was already fixed in the master branch.

I have included all related issues and possible duplicate issues

in this issue (If there are none, check this box anyway).

Mandatory Debugging Information

I have included the output of celery -A proj report in the issue.

(if you are not able to do this, then at least specify the Celery

version affected).

I have verified that the issue exists against the master branch of Celery.

I have included the contents of pip freeze in the issue.

I have included all the versions of all the external dependencies required

to reproduce this bug.

Optional Debugging Information

I have tried reproducing the issue on more than one Python version

and/or implementation.

I have tried reproducing the issue on more than one message broker and/or

result backend.

I have tried reproducing the issue on more than one version of the message

broker and/or result backend.

I have tried reproducing the issue on more than one operating system.

I have tried reproducing the issue on more than one workers pool.

I have tried reproducing the issue with autoscaling, retries,

ETA/Countdown & rate limits disabled.

I have tried reproducing the issue after downgrading

and/or upgrading Celery and its dependencies.

Related Issues and Possible Duplicates

Related Issues

None

Possible Duplicates

None

Environment & Settings

Celery version:

celery report Output:

software -> celery:4.4.6 (cliffs) kombu:4.6.11 py:3.8.2
billiard:3.6.3.0 redis:3.5.3
platform -> system:Linux arch:64bit, ELF
kernel version:4.4.0-18362-Microsoft imp:CPython
loader -> celery.loaders.app.AppLoader
settings -> transport:redis results:redis://localhost:6379/0

BROKER_URL: 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND: 'redis://localhost:6379/0'
CELERY_RESULT_EXPIRES: 15
BROKER_POOL_LIMIT: 0

Steps to Reproduce

Required Dependencies

Minimal Python Version: 3.8.2

Minimal Celery Version: 4.4.6 (cliffs)

Minimal Kombu Version: 4.6.11

Minimal Broker Version: Redis server v=5.0.7

Minimal Result Backend Version: Redis server v=5.0.7

Minimal OS and/or Kernel Version: WSL on Windows 10

Minimal Broker Client Version: redis:3.5.3

Minimal Result Backend Client Version: redis:3.5.3

Python Packages

pip freeze Output:

Other Dependencies

Minimally Reproducible Test Case

from celery import Celery

CONFIG = {
'BROKER_URL': 'redis://localhost:6379/0',
'CELERY_RESULT_BACKEND': 'redis://localhost:6379/0',
'CELERY_RESULT_EXPIRES': 15, # 15 secs
'BROKER_POOL_LIMIT': 0, # redis connection get closed once task is done..
}

celery = Celery('tasks', config_source=CONFIG)

@celery.task(name='tasks.say_hello')
def say_hello():
return "Helloooooo i just came out from the background!"

if __name__ == '__main__':
say_hello.delay().get()

Expected Behavior

Should remove the completed tasks, incase of that. in Redis I would have this output:

127.0.0.1:6379> KEYS *
1) "_kombu.binding.celery"
2) "_kombu.binding.celery.pidbox"
3) "_kombu.binding.celeryev"

Actual Behavior

When connecting to redis-cli after 10 minutes when tasks completed and do:

127.0.0.1:6379> KEYS *
1) "_kombu.binding.celery"
2) "_kombu.binding.celery.pidbox"
3) "_kombu.binding.celeryev"
4) "celery-task-meta-854543d8-14ad-4bf8-9725-edcf64131bb2"
5) "celery-task-meta-fa3e267e-46d0-4488-a766-d3276b6abdeb"
6) "celery-task-meta-86c2d83c-cadd-41b9-b4ff-426607786299"

As you can see, tasks numbered from 4 to 6 which was completed are still there.

Celery was run as following:

celery worker -A tasks-l info
celery beat -A tasks -l info