<h1 dir="auto">Checklist</h1>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/issues?utf8=%E2%9C%93&amp;q=is%3Aissue+label%3A%22Category%3A+Documentation%22+">issues list</a><br>
for similar or identical bug reports.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed fixes.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/commits/master">commit log</a><br>
to find out if the bug was already fixed in the master branch.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included all related issues and possible duplicate issues in this issue<br>
(If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Related Issues and Possible Duplicates</h2>

<h4 dir="auto">Related Issues</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h1 dir="auto">Description</h1>

<h1 dir="auto">Suggestions</h1>
<h1 dir="auto">Checklist</h1>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> This has already been asked to the <a href="https://groups.google.com/forum/#!forum/celery-users" rel="nofollow">discussion group</a> first.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the relevant section in the<br>
<a href="http://docs.celeryproject.org/en/latest/contributing.html#other-bugs" rel="nofollow">contribution guide</a><br>
on reporting bugs.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/issues?q=is%3Aissue+label%3A%22Issue+Type%3A+Bug+Report%22+-label%3A%22Category%3A+Documentation%22">issues list</a><br>
for similar or identical bug reports.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22PR+Type%3A+Bugfix%22+-label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed fixes.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/commits/master">commit log</a><br>
to find out if the bug was already fixed in the master branch.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included all related issues and possible duplicate issues<br>
in this issue (If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Mandatory Debugging Information</h2>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included the output of <code class="notranslate">celery -A proj report</code> in the issue.<br>
(if you are not able to do this, then at least specify the Celery<br>
version affected).</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included the contents of <code class="notranslate">pip freeze</code> in the issue.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included all the versions of all the external dependencies required<br>
to reproduce this bug.</li>
</ul>
<h2 dir="auto">Optional Debugging Information</h2>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one Python version<br>
and/or implementation.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one message broker and/or<br>
result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one version of the message<br>
broker and/or result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have tried reproducing the issue on more than one operating system.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have tried reproducing the issue on more than one workers pool.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue with autoscaling, retries,<br>
ETA/Countdown &amp; rate limits disabled.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue after downgrading<br>
and/or upgrading Celery and its dependencies.</li>
</ul>
<h2 dir="auto">Related Issues and Possible Duplicates</h2>

<h4 dir="auto">Related Issues</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h2 dir="auto">Environment &amp; Settings</h2>

<p dir="auto"><strong>Celery version</strong>:</p>

<details>
<summary><b><code class="notranslate">celery report</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="software -&gt; celery:4.4.6 (cliffs) kombu:4.6.11 py:3.8.2
            billiard:3.6.3.0 redis:3.5.3
platform -&gt; system:Linux arch:64bit, ELF
            kernel version:4.4.0-18362-Microsoft imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; 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"><pre class="notranslate"><code class="notranslate">software -&gt; celery:4.4.6 (cliffs) kombu:4.6.11 py:3.8.2
            billiard:3.6.3.0 redis:3.5.3
platform -&gt; system:Linux arch:64bit, ELF
            kernel version:4.4.0-18362-Microsoft imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; 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
</code></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Steps to Reproduce</h1>
<h2 dir="auto">Required Dependencies</h2>

<ul dir="auto">
<li><strong>Minimal Python Version</strong>: 3.8.2</li>
<li><strong>Minimal Celery Version</strong>: 4.4.6 (cliffs)</li>
<li><strong>Minimal Kombu Version</strong>: 4.6.11</li>
<li><strong>Minimal Broker Version</strong>: Redis server v=5.0.7</li>
<li><strong>Minimal Result Backend Version</strong>: Redis server v=5.0.7</li>
<li><strong>Minimal OS and/or Kernel Version</strong>: WSL on Windows 10</li>
<li><strong>Minimal Broker Client Version</strong>: redis:3.5.3</li>
<li><strong>Minimal Result Backend Client Version</strong>: redis:3.5.3</li>
</ul>
<h3 dir="auto">Python Packages</h3>

<details>
<summary><b><code class="notranslate">pip freeze</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate"></code></pre></div>
<p dir="auto"></p>
</details>
<h3 dir="auto">Other Dependencies</h3>

<details>
<p dir="auto">
</p>
</details>
<h2 dir="auto">Minimally Reproducible Test Case</h2>

<p dir="auto">
</p><div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="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 &quot;Helloooooo i just came out from the background!&quot;


if __name__ == '__main__':
    say_hello.delay().get()"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">celery</span> <span class="pl-k">import</span> <span class="pl-v">Celery</span>

<span class="pl-v">CONFIG</span> <span class="pl-c1">=</span> {
    <span class="pl-s">'BROKER_URL'</span>: <span class="pl-s">'redis://localhost:6379/0'</span>,
    <span class="pl-s">'CELERY_RESULT_BACKEND'</span>: <span class="pl-s">'redis://localhost:6379/0'</span>,
    <span class="pl-s">'CELERY_RESULT_EXPIRES'</span>: <span class="pl-c1">15</span>, <span class="pl-c"># 15 secs</span>
    <span class="pl-s">'BROKER_POOL_LIMIT'</span>: <span class="pl-c1">0</span>, <span class="pl-c"># redis connection get closed once task is done..</span>
}


<span class="pl-s1">celery</span> <span class="pl-c1">=</span> <span class="pl-v">Celery</span>(<span class="pl-s">'tasks'</span>, <span class="pl-s1">config_source</span><span class="pl-c1">=</span><span class="pl-v">CONFIG</span>)

<span class="pl-en">@<span class="pl-s1">celery</span>.<span class="pl-en">task</span>(<span class="pl-s1">name</span><span class="pl-c1">=</span><span class="pl-s">'tasks.say_hello'</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">say_hello</span>():
    <span class="pl-k">return</span> <span class="pl-s">"Helloooooo i just came out from the background!"</span>


<span class="pl-k">if</span> <span class="pl-s1">__name__</span> <span class="pl-c1">==</span> <span class="pl-s">'__main__'</span>:
    <span class="pl-s1">say_hello</span>.<span class="pl-en">delay</span>().<span class="pl-en">get</span>()</pre></div>
<p dir="auto"></p>
<h1 dir="auto">Expected Behavior</h1>

<p dir="auto">Should remove the completed tasks, incase of that. in Redis I would have this output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="127.0.0.1:6379&gt; KEYS *
1) &quot;_kombu.binding.celery&quot;
2) &quot;_kombu.binding.celery.pidbox&quot;
3) &quot;_kombu.binding.celeryev&quot;"><pre class="notranslate"><code class="notranslate">127.0.0.1:6379&gt; KEYS *
1) "_kombu.binding.celery"
2) "_kombu.binding.celery.pidbox"
3) "_kombu.binding.celeryev"
</code></pre></div>
<h1 dir="auto">Actual Behavior</h1>

<p dir="auto">When connecting to redis-cli after 10 minutes when tasks completed and do:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="127.0.0.1:6379&gt; KEYS *
1) &quot;_kombu.binding.celery&quot;
2) &quot;_kombu.binding.celery.pidbox&quot;
3) &quot;_kombu.binding.celeryev&quot;
4) &quot;celery-task-meta-854543d8-14ad-4bf8-9725-edcf64131bb2&quot;
5) &quot;celery-task-meta-fa3e267e-46d0-4488-a766-d3276b6abdeb&quot;
6) &quot;celery-task-meta-86c2d83c-cadd-41b9-b4ff-426607786299&quot;"><pre class="notranslate"><code class="notranslate">127.0.0.1:6379&gt; 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"
</code></pre></div>
<p dir="auto">As you can see, tasks numbered from 4 to 6 which was completed are still there.</p>
<h3 dir="auto">Celery was run as following:</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="celery worker -A tasks-l info
celery beat -A tasks -l info"><pre class="notranslate"><code class="notranslate">celery worker -A tasks-l info
celery beat -A tasks -l info
</code></pre></div>