<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"> 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" checked=""> 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"> 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"> 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" checked=""> I have tried reproducing the issue after downgrading<br>
and/or upgrading Celery and its dependencies.</li>
</ul>
<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>: 4.4.0</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.0 (cliffs) kombu:4.6.7 py:3.7.3
            billiard:3.6.1.0 py-amqp:2.5.2
platform -&gt; system:Linux arch:64bit, ELF
            kernel version:5.0.0-37-generic imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:amqp results:redis://redis/

CELERY_BROKER_URL: 'amqp://guest:********@rabbit:5672//'
CELERY_RESULT_BACKEND: 'redis://redis/'
CELERY_TASK_SERIALIZER: 'json'
is_overridden: &lt;bound method Settings.is_overridden of &lt;Settings &quot;app.settings&quot;&gt;&gt;
beat_schedule: {}
task_routes: {
 'app.tasks.*': {'queue': 'main'}}"><pre class="notranslate"><code class="notranslate">software -&gt; celery:4.4.0 (cliffs) kombu:4.6.7 py:3.7.3
            billiard:3.6.1.0 py-amqp:2.5.2
platform -&gt; system:Linux arch:64bit, ELF
            kernel version:5.0.0-37-generic imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:amqp results:redis://redis/

CELERY_BROKER_URL: 'amqp://guest:********@rabbit:5672//'
CELERY_RESULT_BACKEND: 'redis://redis/'
CELERY_TASK_SERIALIZER: 'json'
is_overridden: &lt;bound method Settings.is_overridden of &lt;Settings "app.settings"&gt;&gt;
beat_schedule: {}
task_routes: {
 'app.tasks.*': {'queue': 'main'}}
</code></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Steps to Reproduce</h1>
<ol dir="auto">
<li>Start celery worker with <code class="notranslate">--concurrency 8</code> and <code class="notranslate">-O fair</code> using code from test case below</li>
<li>Call a broken task via <code class="notranslate">celery -A app.celery_app call app.tasks.bug.task</code></li>
<li>Call a correct task via <code class="notranslate">celery -A app.celery_app call app.tasks.bug.task_correct</code></li>
</ol>
<h2 dir="auto">Required Dependencies</h2>

<ul dir="auto">
<li><strong>Minimal Python Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Celery Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Kombu Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Version</strong>: N/A or Unknown</li>
<li><strong>Minimal OS and/or Kernel Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Client Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Client Version</strong>: N/A or Unknown</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="aiohttp==3.6.2
amqp==2.5.2
asgiref==3.2.3
async-timeout==3.0.1
attrs==19.3.0
billiard==3.6.1.0
celery==4.4.0
certifi==2019.9.11
chardet==3.0.4
curlify==2.2.1
decorator==4.4.1
defusedxml==0.6.0
Django==3.0.2
django-braces==1.13.0
django-cors-headers==3.1.1
django-filter==2.2.0
django-oauth-toolkit==1.2.0
django-rest-framework-social-oauth2==1.1.0
django-templated-mail==1.1.1
djangorestframework==3.11.0
djoser==2.0.3
drf-nested-routers==0.91
facebook-business==5.0.0
ffmpeg-python==0.2.0
future==0.18.1
idna==2.8
ImageHash==4.0
imageio==2.6.1
imageio-ffmpeg==0.3.0
importlib-metadata==1.3.0
kombu==4.6.7
more-itertools==8.0.2
moviepy==1.0.1
multidict==4.5.2
numpy==1.17.4
oauthlib==3.1.0
Pillow==6.2.0
proglog==0.1.9
psycopg2-binary==2.8.3
PyJWT==1.7.1
pymongo==3.9.0
pyslack==0.5.0
python3-openid==3.1.0
pytz==2019.2
PyWavelets==1.1.1
redis==3.3.8
requests==2.22.0
requests-oauthlib==1.2.0
rest-social-auth==3.0.0
scipy==1.3.2
sentry-sdk==0.13.5
six==1.12.0
slackclient==2.3.0
social-auth-app-django==3.1.0
social-auth-core==3.2.0
sqlparse==0.3.0
tqdm==4.39.0
urllib3==1.25.6
vine==1.3.0
yarl==1.3.0
zipp==0.6.0"><pre class="notranslate"><code class="notranslate">aiohttp==3.6.2
amqp==2.5.2
asgiref==3.2.3
async-timeout==3.0.1
attrs==19.3.0
billiard==3.6.1.0
celery==4.4.0
certifi==2019.9.11
chardet==3.0.4
curlify==2.2.1
decorator==4.4.1
defusedxml==0.6.0
Django==3.0.2
django-braces==1.13.0
django-cors-headers==3.1.1
django-filter==2.2.0
django-oauth-toolkit==1.2.0
django-rest-framework-social-oauth2==1.1.0
django-templated-mail==1.1.1
djangorestframework==3.11.0
djoser==2.0.3
drf-nested-routers==0.91
facebook-business==5.0.0
ffmpeg-python==0.2.0
future==0.18.1
idna==2.8
ImageHash==4.0
imageio==2.6.1
imageio-ffmpeg==0.3.0
importlib-metadata==1.3.0
kombu==4.6.7
more-itertools==8.0.2
moviepy==1.0.1
multidict==4.5.2
numpy==1.17.4
oauthlib==3.1.0
Pillow==6.2.0
proglog==0.1.9
psycopg2-binary==2.8.3
PyJWT==1.7.1
pymongo==3.9.0
pyslack==0.5.0
python3-openid==3.1.0
pytz==2019.2
PyWavelets==1.1.1
redis==3.3.8
requests==2.22.0
requests-oauthlib==1.2.0
rest-social-auth==3.0.0
scipy==1.3.2
sentry-sdk==0.13.5
six==1.12.0
slackclient==2.3.0
social-auth-app-django==3.1.0
social-auth-core==3.2.0
sqlparse==0.3.0
tqdm==4.39.0
urllib3==1.25.6
vine==1.3.0
yarl==1.3.0
zipp==0.6.0
</code></pre></div>
<p dir="auto"></p>
</details>
<h3 dir="auto">Other Dependencies</h3>
<details>
<p dir="auto">
N/A
</p>
</details>
<h2 dir="auto">Minimally Reproducible Test Case</h2>

<details>
<p dir="auto">
</p><div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from time import sleep

from celery import chord, group

from app.celery_app import app


@app.task
def task():
    chord([
        a.s(1) | group([b.si(), b.si()]),
        a.s(3) | group([b.si(), b.si()]),
    ])(c.si())
    

@app.task
def task_correct():
    chord([
        a.s(1) | group([b.si(), b.si()]) | dummy.si(),
        a.s(3) | group([b.si(), b.si()]) | dummy.si(),
    ])(c.si())


@app.task
def dummy():
    pass


@app.task
def a(delay):
    sleep(delay)


@app.task
def b():
    pass


@app.task
def c():
    pass"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">time</span> <span class="pl-k">import</span> <span class="pl-s1">sleep</span>

<span class="pl-k">from</span> <span class="pl-s1">celery</span> <span class="pl-k">import</span> <span class="pl-s1">chord</span>, <span class="pl-s1">group</span>

<span class="pl-k">from</span> <span class="pl-s1">app</span>.<span class="pl-s1">celery_app</span> <span class="pl-k">import</span> <span class="pl-s1">app</span>


<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-s1">task</span></span>
<span class="pl-k">def</span> <span class="pl-en">task</span>():
    <span class="pl-en">chord</span>([
        <span class="pl-s1">a</span>.<span class="pl-en">s</span>(<span class="pl-c1">1</span>) <span class="pl-c1">|</span> <span class="pl-en">group</span>([<span class="pl-s1">b</span>.<span class="pl-en">si</span>(), <span class="pl-s1">b</span>.<span class="pl-en">si</span>()]),
        <span class="pl-s1">a</span>.<span class="pl-en">s</span>(<span class="pl-c1">3</span>) <span class="pl-c1">|</span> <span class="pl-en">group</span>([<span class="pl-s1">b</span>.<span class="pl-en">si</span>(), <span class="pl-s1">b</span>.<span class="pl-en">si</span>()]),
    ])(<span class="pl-s1">c</span>.<span class="pl-en">si</span>())
    

<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-s1">task</span></span>
<span class="pl-k">def</span> <span class="pl-en">task_correct</span>():
    <span class="pl-en">chord</span>([
        <span class="pl-s1">a</span>.<span class="pl-en">s</span>(<span class="pl-c1">1</span>) <span class="pl-c1">|</span> <span class="pl-en">group</span>([<span class="pl-s1">b</span>.<span class="pl-en">si</span>(), <span class="pl-s1">b</span>.<span class="pl-en">si</span>()]) <span class="pl-c1">|</span> <span class="pl-s1">dummy</span>.<span class="pl-en">si</span>(),
        <span class="pl-s1">a</span>.<span class="pl-en">s</span>(<span class="pl-c1">3</span>) <span class="pl-c1">|</span> <span class="pl-en">group</span>([<span class="pl-s1">b</span>.<span class="pl-en">si</span>(), <span class="pl-s1">b</span>.<span class="pl-en">si</span>()]) <span class="pl-c1">|</span> <span class="pl-s1">dummy</span>.<span class="pl-en">si</span>(),
    ])(<span class="pl-s1">c</span>.<span class="pl-en">si</span>())


<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-s1">task</span></span>
<span class="pl-k">def</span> <span class="pl-en">dummy</span>():
    <span class="pl-k">pass</span>


<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-s1">task</span></span>
<span class="pl-k">def</span> <span class="pl-en">a</span>(<span class="pl-s1">delay</span>):
    <span class="pl-en">sleep</span>(<span class="pl-s1">delay</span>)


<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-s1">task</span></span>
<span class="pl-k">def</span> <span class="pl-en">b</span>():
    <span class="pl-k">pass</span>


<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-s1">task</span></span>
<span class="pl-k">def</span> <span class="pl-en">c</span>():
    <span class="pl-k">pass</span></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>
<p dir="auto">I expect the tasks to complete in the following order:<br>
<code class="notranslate">A B B A B B C</code></p>
<h1 dir="auto">Actual Behavior</h1>
<p dir="auto">Task C gets duplicated:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[2020-01-31 13:48:40,765: INFO/MainProcess] Received task: app.tasks.bug.task[9d35ec5f-a268-4db9-9068-1e27fe64cef9]  
[2020-01-31 13:48:40,817: INFO/MainProcess] Received task: app.tasks.bug.a[b2833570-bca5-4875-ab6d-e3ec339f36d1]  
[2020-01-31 13:48:40,824: INFO/MainProcess] Received task: app.tasks.bug.a[3d49f0d7-6b1a-4937-ac1c-29bac230e533]  
[2020-01-31 13:48:40,828: INFO/ForkPoolWorker-8] Task app.tasks.bug.task[9d35ec5f-a268-4db9-9068-1e27fe64cef9] succeeded in 0.06039188499562442s: None
[2020-01-31 13:48:41,864: INFO/MainProcess] Received task: app.tasks.bug.b[796bcd9f-f548-4282-9f6d-16ddb3ddc29b]  
[2020-01-31 13:48:41,867: INFO/ForkPoolWorker-8] Task app.tasks.bug.b[796bcd9f-f548-4282-9f6d-16ddb3ddc29b] succeeded in 0.001961939036846161s: None
[2020-01-31 13:48:41,869: INFO/MainProcess] Received task: app.tasks.bug.b[eacaa3ce-cc71-4daf-8e62-8d24f9322c7b]  
[2020-01-31 13:48:41,871: INFO/ForkPoolWorker-9] Task app.tasks.bug.a[b2833570-bca5-4875-ab6d-e3ec339f36d1] succeeded in 1.0521306470036507s: None
[2020-01-31 13:48:41,884: INFO/ForkPoolWorker-8] Task app.tasks.bug.b[eacaa3ce-cc71-4daf-8e62-8d24f9322c7b] succeeded in 0.013368424959480762s: None
[2020-01-31 13:48:41,884: INFO/MainProcess] Received task: app.tasks.bug.c[8e50636b-a440-454e-a6fe-57bb7595b82f]  
[2020-01-31 13:48:41,886: INFO/ForkPoolWorker-8] Task app.tasks.bug.c[8e50636b-a440-454e-a6fe-57bb7595b82f] succeeded in 0.0010153759503737092s: None
[2020-01-31 13:48:43,880: INFO/MainProcess] Received task: app.tasks.bug.b[07eb9c18-1303-4517-b95b-d555de1d6315]  
[2020-01-31 13:48:43,884: INFO/ForkPoolWorker-8] Task app.tasks.bug.b[07eb9c18-1303-4517-b95b-d555de1d6315] succeeded in 0.0018030810169875622s: None
[2020-01-31 13:48:43,887: INFO/MainProcess] Received task: app.tasks.bug.b[7ebaf58a-28f5-4170-86fb-61c3b5ee1909]  
[2020-01-31 13:48:43,887: INFO/ForkPoolWorker-2] Task app.tasks.bug.a[3d49f0d7-6b1a-4937-ac1c-29bac230e533] succeeded in 3.0580567660508677s: None
[2020-01-31 13:48:43,892: INFO/ForkPoolWorker-8] Task app.tasks.bug.b[7ebaf58a-28f5-4170-86fb-61c3b5ee1909] succeeded in 0.004260396934114397s: None
[2020-01-31 13:48:43,893: INFO/MainProcess] Received task: app.tasks.bug.c[8e50636b-a440-454e-a6fe-57bb7595b82f]  
[2020-01-31 13:48:43,896: INFO/ForkPoolWorker-8] Task app.tasks.bug.c[8e50636b-a440-454e-a6fe-57bb7595b82f] succeeded in 0.000999139971099794s: None"><pre class="notranslate"><code class="notranslate">[2020-01-31 13:48:40,765: INFO/MainProcess] Received task: app.tasks.bug.task[9d35ec5f-a268-4db9-9068-1e27fe64cef9]  
[2020-01-31 13:48:40,817: INFO/MainProcess] Received task: app.tasks.bug.a[b2833570-bca5-4875-ab6d-e3ec339f36d1]  
[2020-01-31 13:48:40,824: INFO/MainProcess] Received task: app.tasks.bug.a[3d49f0d7-6b1a-4937-ac1c-29bac230e533]  
[2020-01-31 13:48:40,828: INFO/ForkPoolWorker-8] Task app.tasks.bug.task[9d35ec5f-a268-4db9-9068-1e27fe64cef9] succeeded in 0.06039188499562442s: None
[2020-01-31 13:48:41,864: INFO/MainProcess] Received task: app.tasks.bug.b[796bcd9f-f548-4282-9f6d-16ddb3ddc29b]  
[2020-01-31 13:48:41,867: INFO/ForkPoolWorker-8] Task app.tasks.bug.b[796bcd9f-f548-4282-9f6d-16ddb3ddc29b] succeeded in 0.001961939036846161s: None
[2020-01-31 13:48:41,869: INFO/MainProcess] Received task: app.tasks.bug.b[eacaa3ce-cc71-4daf-8e62-8d24f9322c7b]  
[2020-01-31 13:48:41,871: INFO/ForkPoolWorker-9] Task app.tasks.bug.a[b2833570-bca5-4875-ab6d-e3ec339f36d1] succeeded in 1.0521306470036507s: None
[2020-01-31 13:48:41,884: INFO/ForkPoolWorker-8] Task app.tasks.bug.b[eacaa3ce-cc71-4daf-8e62-8d24f9322c7b] succeeded in 0.013368424959480762s: None
[2020-01-31 13:48:41,884: INFO/MainProcess] Received task: app.tasks.bug.c[8e50636b-a440-454e-a6fe-57bb7595b82f]  
[2020-01-31 13:48:41,886: INFO/ForkPoolWorker-8] Task app.tasks.bug.c[8e50636b-a440-454e-a6fe-57bb7595b82f] succeeded in 0.0010153759503737092s: None
[2020-01-31 13:48:43,880: INFO/MainProcess] Received task: app.tasks.bug.b[07eb9c18-1303-4517-b95b-d555de1d6315]  
[2020-01-31 13:48:43,884: INFO/ForkPoolWorker-8] Task app.tasks.bug.b[07eb9c18-1303-4517-b95b-d555de1d6315] succeeded in 0.0018030810169875622s: None
[2020-01-31 13:48:43,887: INFO/MainProcess] Received task: app.tasks.bug.b[7ebaf58a-28f5-4170-86fb-61c3b5ee1909]  
[2020-01-31 13:48:43,887: INFO/ForkPoolWorker-2] Task app.tasks.bug.a[3d49f0d7-6b1a-4937-ac1c-29bac230e533] succeeded in 3.0580567660508677s: None
[2020-01-31 13:48:43,892: INFO/ForkPoolWorker-8] Task app.tasks.bug.b[7ebaf58a-28f5-4170-86fb-61c3b5ee1909] succeeded in 0.004260396934114397s: None
[2020-01-31 13:48:43,893: INFO/MainProcess] Received task: app.tasks.bug.c[8e50636b-a440-454e-a6fe-57bb7595b82f]  
[2020-01-31 13:48:43,896: INFO/ForkPoolWorker-8] Task app.tasks.bug.c[8e50636b-a440-454e-a6fe-57bb7595b82f] succeeded in 0.000999139971099794s: None
</code></pre></div>
<p dir="auto">Actual execution order is weird, and task C is executed twice.</p>
<p dir="auto">But when you add a dummy task to the end of each chain, execution order becomes correct (as seen in <code class="notranslate">task_correct</code> task):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[2020-01-31 15:13:00,867: INFO/MainProcess] Received task: app.tasks.bug.task_correct[d9dd4fb3-8df9-4c39-8b3d-e8892f9d6fef]  
[2020-01-31 15:13:00,928: INFO/MainProcess] Received task: app.tasks.bug.a[e7eb341f-3c10-4bb0-9dee-2cfa38354005]  
[2020-01-31 15:13:00,939: INFO/MainProcess] Received task: app.tasks.bug.a[c13967b3-b53a-4005-9249-dffa4b6122af]  
[2020-01-31 15:13:00,941: INFO/ForkPoolWorker-8] Task app.tasks.bug.task_correct[d9dd4fb3-8df9-4c39-8b3d-e8892f9d6fef] succeeded in 0.07147384795825928s: None
[2020-01-31 15:13:01,974: INFO/MainProcess] Received task: app.tasks.bug.b[88ceb430-5056-40a1-ae82-cfd95d27845e]  
[2020-01-31 15:13:01,977: INFO/MainProcess] Received task: app.tasks.bug.b[3a354338-edb7-447b-9d40-855e9e386531]  
[2020-01-31 15:13:01,977: INFO/ForkPoolWorker-9] Task app.tasks.bug.a[e7eb341f-3c10-4bb0-9dee-2cfa38354005] succeeded in 1.0470000900095329s: None
[2020-01-31 15:13:01,978: INFO/ForkPoolWorker-8] Task app.tasks.bug.b[88ceb430-5056-40a1-ae82-cfd95d27845e] succeeded in 0.0024882910074666142s: None
[2020-01-31 15:13:02,008: INFO/MainProcess] Received task: app.tasks.bug.dummy[2b9094d8-fe73-43b3-9a2a-c5ad756b3e22]  
[2020-01-31 15:13:02,009: INFO/ForkPoolWorker-3] Task app.tasks.bug.b[3a354338-edb7-447b-9d40-855e9e386531] succeeded in 0.02914690098259598s: None
[2020-01-31 15:13:02,013: INFO/ForkPoolWorker-8] Task app.tasks.bug.dummy[2b9094d8-fe73-43b3-9a2a-c5ad756b3e22] succeeded in 0.002397596021182835s: None
[2020-01-31 15:13:03,989: INFO/MainProcess] Received task: app.tasks.bug.b[fafd28c6-55d0-41c5-a035-1d4da0d6067b]  
[2020-01-31 15:13:03,992: INFO/MainProcess] Received task: app.tasks.bug.b[ea8c9c21-f860-4268-b44c-6faa8ba66dc2]  
[2020-01-31 15:13:03,993: INFO/ForkPoolWorker-8] Task app.tasks.bug.b[fafd28c6-55d0-41c5-a035-1d4da0d6067b] succeeded in 0.0024769710144028068s: None
[2020-01-31 15:13:03,994: INFO/ForkPoolWorker-2] Task app.tasks.bug.a[c13967b3-b53a-4005-9249-dffa4b6122af] succeeded in 3.050520417978987s: None
[2020-01-31 15:13:04,001: INFO/ForkPoolWorker-9] Task app.tasks.bug.b[ea8c9c21-f860-4268-b44c-6faa8ba66dc2] succeeded in 0.006369335926137865s: None
[2020-01-31 15:13:04,001: INFO/MainProcess] Received task: app.tasks.bug.dummy[998aa572-9010-4991-856a-191cf1741680]  
[2020-01-31 15:13:04,021: INFO/MainProcess] Received task: app.tasks.bug.c[976f5323-1505-41c6-ad01-e0e720c4b5c7]  
[2020-01-31 15:13:04,021: INFO/ForkPoolWorker-8] Task app.tasks.bug.dummy[998aa572-9010-4991-856a-191cf1741680] succeeded in 0.018995660939253867s: None
[2020-01-31 15:13:04,023: INFO/ForkPoolWorker-9] Task app.tasks.bug.c[976f5323-1505-41c6-ad01-e0e720c4b5c7] succeeded in 0.0012671550503000617s: None"><pre class="notranslate"><code class="notranslate">[2020-01-31 15:13:00,867: INFO/MainProcess] Received task: app.tasks.bug.task_correct[d9dd4fb3-8df9-4c39-8b3d-e8892f9d6fef]  
[2020-01-31 15:13:00,928: INFO/MainProcess] Received task: app.tasks.bug.a[e7eb341f-3c10-4bb0-9dee-2cfa38354005]  
[2020-01-31 15:13:00,939: INFO/MainProcess] Received task: app.tasks.bug.a[c13967b3-b53a-4005-9249-dffa4b6122af]  
[2020-01-31 15:13:00,941: INFO/ForkPoolWorker-8] Task app.tasks.bug.task_correct[d9dd4fb3-8df9-4c39-8b3d-e8892f9d6fef] succeeded in 0.07147384795825928s: None
[2020-01-31 15:13:01,974: INFO/MainProcess] Received task: app.tasks.bug.b[88ceb430-5056-40a1-ae82-cfd95d27845e]  
[2020-01-31 15:13:01,977: INFO/MainProcess] Received task: app.tasks.bug.b[3a354338-edb7-447b-9d40-855e9e386531]  
[2020-01-31 15:13:01,977: INFO/ForkPoolWorker-9] Task app.tasks.bug.a[e7eb341f-3c10-4bb0-9dee-2cfa38354005] succeeded in 1.0470000900095329s: None
[2020-01-31 15:13:01,978: INFO/ForkPoolWorker-8] Task app.tasks.bug.b[88ceb430-5056-40a1-ae82-cfd95d27845e] succeeded in 0.0024882910074666142s: None
[2020-01-31 15:13:02,008: INFO/MainProcess] Received task: app.tasks.bug.dummy[2b9094d8-fe73-43b3-9a2a-c5ad756b3e22]  
[2020-01-31 15:13:02,009: INFO/ForkPoolWorker-3] Task app.tasks.bug.b[3a354338-edb7-447b-9d40-855e9e386531] succeeded in 0.02914690098259598s: None
[2020-01-31 15:13:02,013: INFO/ForkPoolWorker-8] Task app.tasks.bug.dummy[2b9094d8-fe73-43b3-9a2a-c5ad756b3e22] succeeded in 0.002397596021182835s: None
[2020-01-31 15:13:03,989: INFO/MainProcess] Received task: app.tasks.bug.b[fafd28c6-55d0-41c5-a035-1d4da0d6067b]  
[2020-01-31 15:13:03,992: INFO/MainProcess] Received task: app.tasks.bug.b[ea8c9c21-f860-4268-b44c-6faa8ba66dc2]  
[2020-01-31 15:13:03,993: INFO/ForkPoolWorker-8] Task app.tasks.bug.b[fafd28c6-55d0-41c5-a035-1d4da0d6067b] succeeded in 0.0024769710144028068s: None
[2020-01-31 15:13:03,994: INFO/ForkPoolWorker-2] Task app.tasks.bug.a[c13967b3-b53a-4005-9249-dffa4b6122af] succeeded in 3.050520417978987s: None
[2020-01-31 15:13:04,001: INFO/ForkPoolWorker-9] Task app.tasks.bug.b[ea8c9c21-f860-4268-b44c-6faa8ba66dc2] succeeded in 0.006369335926137865s: None
[2020-01-31 15:13:04,001: INFO/MainProcess] Received task: app.tasks.bug.dummy[998aa572-9010-4991-856a-191cf1741680]  
[2020-01-31 15:13:04,021: INFO/MainProcess] Received task: app.tasks.bug.c[976f5323-1505-41c6-ad01-e0e720c4b5c7]  
[2020-01-31 15:13:04,021: INFO/ForkPoolWorker-8] Task app.tasks.bug.dummy[998aa572-9010-4991-856a-191cf1741680] succeeded in 0.018995660939253867s: None
[2020-01-31 15:13:04,023: INFO/ForkPoolWorker-9] Task app.tasks.bug.c[976f5323-1505-41c6-ad01-e0e720c4b5c7] succeeded in 0.0012671550503000617s: None
</code></pre></div>
<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 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" checked=""> 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"> 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"> 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>
<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="367917725" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/5100" data-hovercard-type="issue" data-hovercard-url="/celery/celery/issues/5100/hovercard" href="https://github.com/celery/celery/issues/5100">#5100</a></p>
<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>: 4.3.0</p>

<details>
<summary><b><code class="notranslate">
celery -A proj 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.3.0 (rhubarb) kombu:4.5.0 py:2.7.12
            billiard:3.6.0.0 py-amqp:2.4.2
platform -&gt; system:Linux arch:64bit, ELF
            kernel version:4.15.0-47-generic imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:amqp results:disabled"><pre class="notranslate"><code class="notranslate">software -&gt; celery:4.3.0 (rhubarb) kombu:4.5.0 py:2.7.12
            billiard:3.6.0.0 py-amqp:2.4.2
platform -&gt; system:Linux arch:64bit, ELF
            kernel version:4.15.0-47-generic imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:amqp results:disabled
</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>: 2.7</li>
<li><strong>Minimal Celery Version</strong>: 4.0.1 (added support for task request)</li>
<li><strong>Minimal Kombu Version</strong>: N/A</li>
<li><strong>Minimal Broker Version</strong>: N/A</li>
<li><strong>Minimal Result Backend Version</strong>: N/A</li>
<li><strong>Minimal OS and/or Kernel Version</strong>: N/A</li>
<li><strong>Minimal Broker Client Version</strong>: N/A</li>
<li><strong>Minimal Result Backend Client Version</strong>: N/A</li>
</ul>
<h3 dir="auto">Python Packages</h3>

<details>
Relevant dependencies:
<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="celery==4.3.0
kombu==4.5.0"><pre class="notranslate"><code class="notranslate">celery==4.3.0
kombu==4.5.0
</code></pre></div>
<p dir="auto"></p>
</details>
<h3 dir="auto">Other Dependencies</h3>

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

<details>
<p dir="auto">
I was trying to create a new back-end that stored the results of tasks in a different place depending on the tenant for which the task was started, which worked initially, but when I used `update_state` in one of my tasks, my back-end failed because `request` was not present among the arguments.
</p><p dir="auto">This is a dummy implementation of the back-end:<br>
<code class="notranslate">multi_tenant_backend.py</code></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from collections import defaultdict

class MultiTenantBackend(BaseBackend):
    def __init__(self, *args, **kwargs):
        super(BaseBackend, self).__init__(*args, **kwargs)
        self.store = defaultdict(dict)

    def store_result(self, task_id, result, state, traceback=None, request=None, **kwargs):
        tenant = request.get(&quot;_tenant&quot;)
        self.store[tenant][task_id] = (result, state)

    def ensure_chords_allowed(self):
        pass

    def as_uri(self, *args, **kwargs):
        return None

    def get_state(self, task_id):
        return None

    def get_status(self, task_id):
        return None

    def get_result(self, task_id):
        return None

    def get_traceback(self, task_id):
        return None

    def _get_task_meta_for(self, task_id):
        return {}

    def wait_for(self, *args, **kwargs):
        pass"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">collections</span> <span class="pl-k">import</span> <span class="pl-s1">defaultdict</span>

<span class="pl-k">class</span> <span class="pl-v">MultiTenantBackend</span>(<span class="pl-v">BaseBackend</span>):
    <span class="pl-k">def</span> <span class="pl-en">__init__</span>(<span class="pl-s1">self</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>):
        <span class="pl-en">super</span>(<span class="pl-v">BaseBackend</span>, <span class="pl-s1">self</span>).<span class="pl-en">__init__</span>(<span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
        <span class="pl-s1">self</span>.<span class="pl-s1">store</span> <span class="pl-c1">=</span> <span class="pl-en">defaultdict</span>(<span class="pl-s1">dict</span>)

    <span class="pl-k">def</span> <span class="pl-en">store_result</span>(<span class="pl-s1">self</span>, <span class="pl-s1">task_id</span>, <span class="pl-s1">result</span>, <span class="pl-s1">state</span>, <span class="pl-s1">traceback</span><span class="pl-c1">=</span><span class="pl-c1">None</span>, <span class="pl-s1">request</span><span class="pl-c1">=</span><span class="pl-c1">None</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>):
        <span class="pl-s1">tenant</span> <span class="pl-c1">=</span> <span class="pl-s1">request</span>.<span class="pl-en">get</span>(<span class="pl-s">"_tenant"</span>)
        <span class="pl-s1">self</span>.<span class="pl-s1">store</span>[<span class="pl-s1">tenant</span>][<span class="pl-s1">task_id</span>] <span class="pl-c1">=</span> (<span class="pl-s1">result</span>, <span class="pl-s1">state</span>)

    <span class="pl-k">def</span> <span class="pl-en">ensure_chords_allowed</span>(<span class="pl-s1">self</span>):
        <span class="pl-k">pass</span>

    <span class="pl-k">def</span> <span class="pl-en">as_uri</span>(<span class="pl-s1">self</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>):
        <span class="pl-k">return</span> <span class="pl-c1">None</span>

    <span class="pl-k">def</span> <span class="pl-en">get_state</span>(<span class="pl-s1">self</span>, <span class="pl-s1">task_id</span>):
        <span class="pl-k">return</span> <span class="pl-c1">None</span>

    <span class="pl-k">def</span> <span class="pl-en">get_status</span>(<span class="pl-s1">self</span>, <span class="pl-s1">task_id</span>):
        <span class="pl-k">return</span> <span class="pl-c1">None</span>

    <span class="pl-k">def</span> <span class="pl-en">get_result</span>(<span class="pl-s1">self</span>, <span class="pl-s1">task_id</span>):
        <span class="pl-k">return</span> <span class="pl-c1">None</span>

    <span class="pl-k">def</span> <span class="pl-en">get_traceback</span>(<span class="pl-s1">self</span>, <span class="pl-s1">task_id</span>):
        <span class="pl-k">return</span> <span class="pl-c1">None</span>

    <span class="pl-k">def</span> <span class="pl-en">_get_task_meta_for</span>(<span class="pl-s1">self</span>, <span class="pl-s1">task_id</span>):
        <span class="pl-k">return</span> {}

    <span class="pl-k">def</span> <span class="pl-en">wait_for</span>(<span class="pl-s1">self</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>):
        <span class="pl-k">pass</span></pre></div>
<p dir="auto"><code class="notranslate">tasks.py</code></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@celery_app.task(bind=True)
def do_something(task):
    sleep(3)
    task.update_state(state=&quot;DOING_SOMETHING&quot;)"><pre class="notranslate"><span class="pl-en">@<span class="pl-s1">celery_app</span>.<span class="pl-en">task</span>(<span class="pl-s1">bind</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">do_something</span>(<span class="pl-s1">task</span>):
    <span class="pl-en">sleep</span>(<span class="pl-c1">3</span>)
    <span class="pl-s1">task</span>.<span class="pl-en">update_state</span>(<span class="pl-s1">state</span><span class="pl-c1">=</span><span class="pl-s">"DOING_SOMETHING"</span>)</pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<p dir="auto">I would expect the back-end's <code class="notranslate">store_result</code> method to be called with the task's <code class="notranslate">request</code> as an argument when calling <code class="notranslate">task.update_state(state=..., meta=...)</code>.</p>
<h1 dir="auto">Actual Behavior</h1>

<p dir="auto">Calling <code class="notranslate">update_state</code> fails, because the back-end's <code class="notranslate">store_result</code> method is called without the task's <code class="notranslate">request</code> which is used by the back-end to retrieve information.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
worker_1_e608e69813d9 |   File &quot;/usr/local/lib/python2.7/dist-packages/celery/app/trace.py&quot;, line 385, in trace_task
worker_1_e608e69813d9 |     R = retval = fun(*args, **kwargs)
worker_1_e608e69813d9 |   File &quot;/data/alaya/api/common/celery_app.py&quot;, line 113, in __call__
worker_1_e608e69813d9 |     return super(RequestContextTask, self).__call__(*args, **kwargs)
worker_1_e608e69813d9 |   File &quot;/usr/local/lib/python2.7/dist-packages/celery/app/trace.py&quot;, line 648, in __protected_call__
worker_1_e608e69813d9 |     return self.run(*args, **kwargs)
worker_1_e608e69813d9 |   File &quot;/data/alaya/api/scheduleoptimization/alns/core/alns.py&quot;, line 70, in do_something
worker_1_e608e69813d9 |     &quot;some&quot;: &quot;metadata&quot;,
worker_1_e608e69813d9 |   File &quot;/data/alaya/api/common/celery_app.py&quot;, line 140, in update_state
worker_1_e608e69813d9 |     super(RequestContextTask, self).update_state(request=request, **args)
worker_1_e608e69813d9 |   File &quot;/usr/local/lib/python2.7/dist-packages/celery/app/task.py&quot;, line 930, in update_state
worker_1_e608e69813d9 |     self.backend.store_result(task_id, meta, state, **kwargs)
worker_1_e608e69813d9 |   File &quot;/data/alaya/api/common/multi_tenant_backend.py&quot;, line 51, in store_result
worker_1_e608e69813d9 |     tenant = request.get('_tenant')
worker_1_e608e69813d9 | AttributeError: 'NoneType' object has no attribute 'get'"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
worker_1_e608e69813d9 |   File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 385, in trace_task
worker_1_e608e69813d9 |     R = retval = fun(*args, **kwargs)
worker_1_e608e69813d9 |   File "/data/alaya/api/common/celery_app.py", line 113, in __call__
worker_1_e608e69813d9 |     return super(RequestContextTask, self).__call__(*args, **kwargs)
worker_1_e608e69813d9 |   File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 648, in __protected_call__
worker_1_e608e69813d9 |     return self.run(*args, **kwargs)
worker_1_e608e69813d9 |   File "/data/alaya/api/scheduleoptimization/alns/core/alns.py", line 70, in do_something
worker_1_e608e69813d9 |     "some": "metadata",
worker_1_e608e69813d9 |   File "/data/alaya/api/common/celery_app.py", line 140, in update_state
worker_1_e608e69813d9 |     super(RequestContextTask, self).update_state(request=request, **args)
worker_1_e608e69813d9 |   File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py", line 930, in update_state
worker_1_e608e69813d9 |     self.backend.store_result(task_id, meta, state, **kwargs)
worker_1_e608e69813d9 |   File "/data/alaya/api/common/multi_tenant_backend.py", line 51, in store_result
worker_1_e608e69813d9 |     tenant = request.get('_tenant')
worker_1_e608e69813d9 | AttributeError: 'NoneType' object has no attribute 'get'
</code></pre></div>
<p dir="auto">Of course, I can solve the issue by passing <code class="notranslate">task.request</code> when calling <code class="notranslate">update_state</code>, but I don't want to bother doing that just because my back-end depends on it. I could do it in a custom <code class="notranslate">Task</code> class, but I'd prefer if it was the default behavior of <code class="notranslate">celery</code>.</p>
<p dir="auto">A potential fix is to default to passing the task's request here <a href="https://github.com/celery/celery/blob/master/celery/app/task.py#L919">https://github.com/celery/celery/blob/master/celery/app/task.py#L919</a> when it's not present, the same as we are doing with <code class="notranslate">task_id</code> (i.e <code class="notranslate">if task_id is None: task_id = self.request.id</code>.</p>
<p dir="auto">That said, maybe I am missing something and the reason why the <code class="notranslate">request </code> is not passed by default is because the <code class="notranslate">request</code> is not available in some special cases.</p>