<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"> 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"> 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"> 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<br>
in this issue (If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Mandatory Debugging Information</h2>
<p dir="auto">4.4.0</p>
<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"> 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"> 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>
<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:
Started app.
<p dir="auto">software -&gt; celery:4.4.0 (cliffs) kombu:4.6.7 py:3.7.6<br>
billiard:3.6.2.0 py-amqp:2.5.2<br>
platform -&gt; system:Linux arch:64bit, ELF<br>
kernel version:5.3.0-7625-generic imp:CPython<br>
loader   -&gt; celery.loaders.app.AppLoader<br>
settings -&gt; transport:amqp results:redis://localhost:6379/0</p>
</b><p dir="auto"><b>broker_url: 'amqp://guest:<strong><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/localhost/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/localhost">@localhost</a>:5672//'<br>
result_backend: 'redis://localhost:6379/0'<br>
task_routes: {<br>
'task.add': {'queue': 'add', 'routing_key': '</strong>'},<br>
'task.log': {'queue': 'log', 'routing_key': '<strong>'},<br>
'task.receipt': {'queue': 'receipt', 'routing_key': '</strong>'}}<br>
task_annotations: {<br>
'task.log': {'rate_limit': '1/s'}}<br>
</b></p></summary><p dir="auto"></p>
<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>
<h1 dir="auto">Steps to Reproduce</h1>
<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=""><pre class="notranslate"><code class="notranslate"></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">
The below example creates a simple task and 3 queues to receive callbacks when task is completed. The app is configured to use redis backend, yet when the callbacks are invoked within celery, it generates new queues in AMQP rather than using the configured results backend.
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="workers

$ celery -A task worker -n log -Q log --loglevel=info -c 1
$ celery -A task worker -n receipt -Q receipt --loglevel=info -c 1
$ celery -A task worker -n &quot;worker&quot; -Q add --loglevel=info

task.py
===================
from celery import Celery

CELERY_IGNORE_RESULT = True 
CELERY_STORE_ERRORS_EVEN_IF_IGNORED = False

app = Celery('task', backend='redis://localhost:6379/0', broker='amqp://guest@localhost//')

app.conf.task_routes = {
    'task.add': {
        'queue': 'add',
        'routing_key': 'task.add',
    },
    'task.receipt': {
        'queue': 'receipt',
        'routing_key': 'task.receipt',
    'task.log': {
        'queue': 'log',
        'routing_key': 'task.log'
    }
}

app.conf.update(
  task_annotations={
    'task.log': {'rate_limit': '1/s'}
 }
)

print(&quot;Started app.&quot;)

@app.task
def add(x, y):
    return x + y

@app.task
def receipt(result,id):
   print(&quot;Got Result: &quot;,result)
   print(&quot;Add Receipt: &quot;,id)

@app.task
def log(result,id):
   print(&quot;LOG Got Result: &quot;,result)
   print(&quot;LOG Add Receipt: &quot;,id)

run.py
======================
from celery import Celery
from task import add
from task import receipt
from task import log

for i in range(0,10):
   if i % 2:
      r = add.apply((i,i+10),queue=&quot;add&quot;,link=log.s(str(i)+&quot;,&quot;+str(i+10)).set(queue=&quot;log&quot;))
   else:
      r = add.apply((i,i+10),queue=&quot;add&quot;,link=receipt.s(str(i)+&quot;,&quot;+str(i+10)).set(queue=&quot;receipt&quot;))
   print(i,i+10,r.get()) 
   r.forget()
print(&quot;Done&quot;)
"><pre class="notranslate"><code class="notranslate">workers

$ celery -A task worker -n log -Q log --loglevel=info -c 1
$ celery -A task worker -n receipt -Q receipt --loglevel=info -c 1
$ celery -A task worker -n "worker" -Q add --loglevel=info

task.py
===================
from celery import Celery

CELERY_IGNORE_RESULT = True 
CELERY_STORE_ERRORS_EVEN_IF_IGNORED = False

app = Celery('task', backend='redis://localhost:6379/0', broker='amqp://guest@localhost//')

app.conf.task_routes = {
    'task.add': {
        'queue': 'add',
        'routing_key': 'task.add',
    },
    'task.receipt': {
        'queue': 'receipt',
        'routing_key': 'task.receipt',
    'task.log': {
        'queue': 'log',
        'routing_key': 'task.log'
    }
}

app.conf.update(
  task_annotations={
    'task.log': {'rate_limit': '1/s'}
 }
)

print("Started app.")

@app.task
def add(x, y):
    return x + y

@app.task
def receipt(result,id):
   print("Got Result: ",result)
   print("Add Receipt: ",id)

@app.task
def log(result,id):
   print("LOG Got Result: ",result)
   print("LOG Add Receipt: ",id)

run.py
======================
from celery import Celery
from task import add
from task import receipt
from task import log

for i in range(0,10):
   if i % 2:
      r = add.apply((i,i+10),queue="add",link=log.s(str(i)+","+str(i+10)).set(queue="log"))
   else:
      r = add.apply((i,i+10),queue="add",link=receipt.s(str(i)+","+str(i+10)).set(queue="receipt"))
   print(i,i+10,r.get()) 
   r.forget()
print("Done")

</code></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<p dir="auto">Callbacks provided in link= arguments in task signatures should respect the configured backend in the app.</p>
<h1 dir="auto">Actual Behavior</h1>

<p dir="auto">Link callbacks are storing their results in amqp queues instead of the configured backend.</p>
<p dir="auto">Tested with the <code class="notranslate">4.2.0rc2</code> version.</p>
<h2 dir="auto">Steps to reproduce</h2>
<p dir="auto">Set the <code class="notranslate">link_error</code> of any task with a class based task and make sure the executed task will fail so the callback would be called.</p>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">Work?</p>
<h2 dir="auto">Actual behavior</h2>
<p dir="auto">The callback is not executed and an exception is raised ( AttributeError ).<br>
<code class="notranslate">object has no attribute '__header__'</code></p>
<p dir="auto">Related to/duplicate of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="272481334" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/4377" data-hovercard-type="issue" data-hovercard-url="/celery/celery/issues/4377/hovercard" href="https://github.com/celery/celery/issues/4377">#4377</a></p>