<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 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" checked=""> 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" 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 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>
<p dir="auto">I have a fairly basic setup of celery running on <code class="notranslate">4.4.6</code> most of the task look like</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@app.task(bind=True)
def get_some_data_from_a_server_and_update_records(self, ...):
   # Make a request using requests via a Session that is maintained by the instance of the SDK
   my_sdk_client = Client()
   
   response = my_sdk_client.session.get(...)

   # Update my database
"><pre class="notranslate"><span class="pl-en">@<span class="pl-s1">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">get_some_data_from_a_server_and_update_records</span>(<span class="pl-s1">self</span>, ...):
   <span class="pl-c"># Make a request using requests via a Session that is maintained by the instance of the SDK</span>
   <span class="pl-s1">my_sdk_client</span> <span class="pl-c1">=</span> <span class="pl-v">Client</span>()
   
   <span class="pl-s1">response</span> <span class="pl-c1">=</span> <span class="pl-s1">my_sdk_client</span>.<span class="pl-s1">session</span>.<span class="pl-en">get</span>(...)

   <span class="pl-c"># Update my database</span></pre></div>
<p dir="auto">Django celery settings</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Celery
CELERY_BROKER_URL = REDIS_URL
CELERY_RESULT_BACKEND = REDIS_URL

CELERY_TASK_QUEUES = (
    Queue('critical', Exchange('critical'), routing_key='critical'),
    Queue('high', Exchange('high'), routing_key='high'),
    Queue('medium', Exchange('medium'), routing_key='medium'),
    Queue('low', Exchange('low'), routing_key='low'),
)
CELERY_TASK_DEFAULT_QUEUE = 'medium'
CELERY_TASK_IGNORE_RESULT = True
CELERY_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_WORKER_HIJACK_ROOT_LOGGER = False
CELERY_WORKER_POOL = 'threads'"><pre class="notranslate"><span class="pl-c"># Celery</span>
<span class="pl-v">CELERY_BROKER_URL</span> <span class="pl-c1">=</span> <span class="pl-v">REDIS_URL</span>
<span class="pl-v">CELERY_RESULT_BACKEND</span> <span class="pl-c1">=</span> <span class="pl-v">REDIS_URL</span>

<span class="pl-v">CELERY_TASK_QUEUES</span> <span class="pl-c1">=</span> (
    <span class="pl-v">Queue</span>(<span class="pl-s">'critical'</span>, <span class="pl-v">Exchange</span>(<span class="pl-s">'critical'</span>), <span class="pl-s1">routing_key</span><span class="pl-c1">=</span><span class="pl-s">'critical'</span>),
    <span class="pl-v">Queue</span>(<span class="pl-s">'high'</span>, <span class="pl-v">Exchange</span>(<span class="pl-s">'high'</span>), <span class="pl-s1">routing_key</span><span class="pl-c1">=</span><span class="pl-s">'high'</span>),
    <span class="pl-v">Queue</span>(<span class="pl-s">'medium'</span>, <span class="pl-v">Exchange</span>(<span class="pl-s">'medium'</span>), <span class="pl-s1">routing_key</span><span class="pl-c1">=</span><span class="pl-s">'medium'</span>),
    <span class="pl-v">Queue</span>(<span class="pl-s">'low'</span>, <span class="pl-v">Exchange</span>(<span class="pl-s">'low'</span>), <span class="pl-s1">routing_key</span><span class="pl-c1">=</span><span class="pl-s">'low'</span>),
)
<span class="pl-v">CELERY_TASK_DEFAULT_QUEUE</span> <span class="pl-c1">=</span> <span class="pl-s">'medium'</span>
<span class="pl-v">CELERY_TASK_IGNORE_RESULT</span> <span class="pl-c1">=</span> <span class="pl-c1">True</span>
<span class="pl-v">CELERY_SERIALIZER</span> <span class="pl-c1">=</span> <span class="pl-s">'json'</span>
<span class="pl-v">CELERY_RESULT_SERIALIZER</span> <span class="pl-c1">=</span> <span class="pl-s">'json'</span>
<span class="pl-v">CELERY_WORKER_HIJACK_ROOT_LOGGER</span> <span class="pl-c1">=</span> <span class="pl-c1">False</span>
<span class="pl-v">CELERY_WORKER_POOL</span> <span class="pl-c1">=</span> <span class="pl-s">'threads'</span></pre></div>
<p dir="auto">Which runs on GKE using multiple pods i.e 8 - 10 pods with each worker reading from a dedicated queue</p>
<p dir="auto">Unfortunately this results in a number of <code class="notranslate">ConnectionErrors</code> as shown below</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="File /venv/lib/python3.6/site-packages/requests/sessions.py line 578 in post
return self.request('POST', url, data=data, json=json, **kwargs)
File /venv/lib/python3.6/site-packages/requests/sessions.py line 530 in request
resp = self.send(prep, **send_kwargs)
File /venv/lib/python3.6/site-packages/requests/sessions.py line 643 in send
r = adapter.send(request, **kwargs)
File /venv/lib/python3.6/site-packages/requests/adapters.py line 498 in send args locals
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', OSError(0, 'Error'))
ProtocolError: ('Connection aborted.', OSError(0, 'Error')) (Most recent call last)"><pre class="notranslate"><span class="pl-v">File</span> <span class="pl-c1">/</span><span class="pl-s1">venv</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">6</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">requests</span><span class="pl-c1">/</span><span class="pl-s1">sessions</span>.<span class="pl-s1">py</span> <span class="pl-s1">line</span> <span class="pl-c1">578</span> <span class="pl-c1">in</span> <span class="pl-s1">post</span>
<span class="pl-k">return</span> <span class="pl-s1">self</span>.<span class="pl-en">request</span>(<span class="pl-s">'POST'</span>, <span class="pl-s1">url</span>, <span class="pl-s1">data</span><span class="pl-c1">=</span><span class="pl-s1">data</span>, <span class="pl-s1">json</span><span class="pl-c1">=</span><span class="pl-s1">json</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
<span class="pl-v">File</span> <span class="pl-c1">/</span><span class="pl-s1">venv</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">6</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">requests</span><span class="pl-c1">/</span><span class="pl-s1">sessions</span>.<span class="pl-s1">py</span> <span class="pl-s1">line</span> <span class="pl-c1">530</span> <span class="pl-c1">in</span> <span class="pl-s1">request</span>
<span class="pl-s1">resp</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">send</span>(<span class="pl-s1">prep</span>, <span class="pl-c1">**</span><span class="pl-s1">send_kwargs</span>)
<span class="pl-v">File</span> <span class="pl-c1">/</span><span class="pl-s1">venv</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">6</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">requests</span><span class="pl-c1">/</span><span class="pl-s1">sessions</span>.<span class="pl-s1">py</span> <span class="pl-s1">line</span> <span class="pl-c1">643</span> <span class="pl-c1">in</span> <span class="pl-s1">send</span>
<span class="pl-s1">r</span> <span class="pl-c1">=</span> <span class="pl-s1">adapter</span>.<span class="pl-en">send</span>(<span class="pl-s1">request</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
<span class="pl-v">File</span> <span class="pl-c1">/</span><span class="pl-s1">venv</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">6</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">requests</span><span class="pl-c1">/</span><span class="pl-s1">adapters</span>.<span class="pl-s1">py</span> <span class="pl-s1">line</span> <span class="pl-c1">498</span> <span class="pl-c1">in</span> <span class="pl-s1">send</span> <span class="pl-s1">args</span> <span class="pl-s1">locals</span>
<span class="pl-k">raise</span> <span class="pl-v">ConnectionError</span>(<span class="pl-s1">err</span>, <span class="pl-s1">request</span><span class="pl-c1">=</span><span class="pl-s1">request</span>)
<span class="pl-v">ConnectionError</span>: (<span class="pl-s">'Connection aborted.'</span>, <span class="pl-v">OSError</span>(<span class="pl-c1">0</span>, <span class="pl-s">'Error'</span>))
<span class="pl-v">ProtocolError</span>: (<span class="pl-s">'Connection aborted.'</span>, <span class="pl-v">OSError</span>(<span class="pl-c1">0</span>, <span class="pl-s">'Error'</span>)) (<span class="pl-v">Most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>)</pre></div>
<p dir="auto">The current docs don't highlight this which seems like a common use case and is currently a pain point.</p>
<p dir="auto">Based: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="262203652" data-permission-text="Title is private" data-url="https://github.com/psf/requests/issues/4323" data-hovercard-type="issue" data-hovercard-url="/psf/requests/issues/4323/hovercard" href="https://github.com/psf/requests/issues/4323">psf/requests#4323</a></p>
<p dir="auto">Most debate around this has been about the lack of multiprocess safety using requests or ensuring you use a single Session per thread/process which doesn't seem feasible when you interact with more than one endpoint or initialize multiple Sessions in different tasks.</p>
<p dir="auto">We switched our execution pool to use <code class="notranslate">threads</code> but this doesn't solve the issue.</p>
<h1 dir="auto">Suggestions</h1>
<ul dir="auto">
<li>Expect a better setup documentation that clearly states how to configure celery on GKE.</li>
<li>How to work with celery and <code class="notranslate">requests</code> or <code class="notranslate">urllib3</code></li>
<li>A Recommended execution pool based on how celery is intended to be used. i.e <code class="notranslate">prefork</code> vs <code class="notranslate">threads</code> or <code class="notranslate">gevent</code> / <code class="notranslate">eventlet</code>.</li>
</ul>
<h2 dir="auto">Package Versions:</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="celery[redis]==4.4.6      # via coherentpath (setup.py), django-celery-beat, flower
certifi==2019.11.28       # via requests, urllib3
cffi==1.13.2              # via bcrypt, cryptography, pynacl
chardet==3.0.4            # via aiohttp, requests
cryptography==3.3.2       # via django-cryptography, paramiko, pyopenssl, requests, urllib3
django-celery-beat==2.0.0  # via coherentpath (setup.py)
django-timezone-field==4.1.1  # via coherentpath (setup.py), django-celery-beat
future==0.18.2            # via celery, django-json-widget, python-jose
humanize==0.5.1           # via flower
idna-ssl==1.1.0           # via aiohttp
idna==2.6                 # via idna-ssl, jsonschema, requests, urllib3, yarl
importlib-metadata==1.6.0  # via kombu, scout-apm
kombu==4.6.11             # via celery
oauthlib==3.1.0           # via django-oauth-toolkit, requests-oauthlib
psycopg2==2.7.3.1         # via coherentpath (setup.py)
pycparser==2.19           # via cffi
pyopenssl==19.1.0         # via requests, urllib3
pyparsing==2.4.7          # via httplib2, packaging
python-crontab==2.5.1     # via django-celery-beat
python-dateutil==2.8.1    # via jsonmodels, pandas, python-crontab
redis==3.5.3              # via celery
requests-toolbelt==0.9.1  # via zeep
requests[security]==2.24.0 
urllib3[secure]==1.25.11  # via pdpyras, requests, scout-apm, selenium
vine==1.3.0               # via amqp, celery"><pre class="notranslate"><code class="notranslate">celery[redis]==4.4.6      # via coherentpath (setup.py), django-celery-beat, flower
certifi==2019.11.28       # via requests, urllib3
cffi==1.13.2              # via bcrypt, cryptography, pynacl
chardet==3.0.4            # via aiohttp, requests
cryptography==3.3.2       # via django-cryptography, paramiko, pyopenssl, requests, urllib3
django-celery-beat==2.0.0  # via coherentpath (setup.py)
django-timezone-field==4.1.1  # via coherentpath (setup.py), django-celery-beat
future==0.18.2            # via celery, django-json-widget, python-jose
humanize==0.5.1           # via flower
idna-ssl==1.1.0           # via aiohttp
idna==2.6                 # via idna-ssl, jsonschema, requests, urllib3, yarl
importlib-metadata==1.6.0  # via kombu, scout-apm
kombu==4.6.11             # via celery
oauthlib==3.1.0           # via django-oauth-toolkit, requests-oauthlib
psycopg2==2.7.3.1         # via coherentpath (setup.py)
pycparser==2.19           # via cffi
pyopenssl==19.1.0         # via requests, urllib3
pyparsing==2.4.7          # via httplib2, packaging
python-crontab==2.5.1     # via django-celery-beat
python-dateutil==2.8.1    # via jsonmodels, pandas, python-crontab
redis==3.5.3              # via celery
requests-toolbelt==0.9.1  # via zeep
requests[security]==2.24.0 
urllib3[secure]==1.25.11  # via pdpyras, requests, scout-apm, selenium
vine==1.3.0               # via amqp, celery
</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 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"> 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" checked=""> 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" checked=""> 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" checked=""> 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" checked=""> 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>
<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="267628429" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/4337" data-hovercard-type="issue" data-hovercard-url="/celery/celery/issues/4337/hovercard" href="https://github.com/celery/celery/issues/4337">#4337</a> -- closed duplicate, partially fixed with <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="281791012" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/4448" data-hovercard-type="pull_request" data-hovercard-url="/celery/celery/pull/4448/hovercard" href="https://github.com/celery/celery/pull/4448">#4448</a> for manual routing (explicitly passing queue name in signature parameters).</p>
<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="celery -A myapp report

software -&gt; celery:5.1.2 (sun-harmonics) kombu:5.1.0 py:3.9.5
            billiard:3.6.4.0 py-amqp:5.0.6
platform -&gt; system:Darwin arch:64bit
            kernel version:20.6.0 imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:amqp results:db+postgresql://postgres:**@postgres:5432/postgres

broker_url: 'amqp://guest:********@localhost:5672//'
result_backend: 'db+postgresql://postgres:********@postgres:5432/postgres'
task_routes: 
    ({'*': {'queue': 'low_priority_queue'},
  'myapp.add_list': {'queue': 'high_priority_queue'}},)
deprecated_settings: None"><pre class="notranslate"><code class="notranslate">celery -A myapp report

software -&gt; celery:5.1.2 (sun-harmonics) kombu:5.1.0 py:3.9.5
            billiard:3.6.4.0 py-amqp:5.0.6
platform -&gt; system:Darwin arch:64bit
            kernel version:20.6.0 imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:amqp results:db+postgresql://postgres:**@postgres:5432/postgres

broker_url: 'amqp://guest:********@localhost:5672//'
result_backend: 'db+postgresql://postgres:********@postgres:5432/postgres'
task_routes: 
    ({'*': {'queue': 'low_priority_queue'},
  'myapp.add_list': {'queue': 'high_priority_queue'}},)
deprecated_settings: None
</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">
</p><p dir="auto"><code class="notranslate">celeryconfig.py</code></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="broker_url = &quot;amqp://guest@localhost//&quot;
result_backend = 'db+postgresql://{user}:{password}@{host}:{port}/{db}'.format(
    user='postgres',
    password='secretsecret',
    host='postgres',
    db='postgres',
    port=5432,
)

task_routes = ({
    &quot;myapp.add_list&quot;: {&quot;queue&quot;: &quot;high_priority_queue&quot;},
    &quot;*&quot;: {&quot;queue&quot;: &quot;low_priority_queue&quot;},
},)
"><pre class="notranslate"><span class="pl-s1">broker_url</span> <span class="pl-c1">=</span> <span class="pl-s">"amqp://guest@localhost//"</span>
<span class="pl-s1">result_backend</span> <span class="pl-c1">=</span> <span class="pl-s">'db+postgresql://{user}:{password}@{host}:{port}/{db}'</span>.<span class="pl-en">format</span>(
    <span class="pl-s1">user</span><span class="pl-c1">=</span><span class="pl-s">'postgres'</span>,
    <span class="pl-s1">password</span><span class="pl-c1">=</span><span class="pl-s">'secretsecret'</span>,
    <span class="pl-s1">host</span><span class="pl-c1">=</span><span class="pl-s">'postgres'</span>,
    <span class="pl-s1">db</span><span class="pl-c1">=</span><span class="pl-s">'postgres'</span>,
    <span class="pl-s1">port</span><span class="pl-c1">=</span><span class="pl-c1">5432</span>,
)

<span class="pl-s1">task_routes</span> <span class="pl-c1">=</span> ({
    <span class="pl-s">"myapp.add_list"</span>: {<span class="pl-s">"queue"</span>: <span class="pl-s">"high_priority_queue"</span>},
    <span class="pl-s">"*"</span>: {<span class="pl-s">"queue"</span>: <span class="pl-s">"low_priority_queue"</span>},
},)</pre></div>
<p dir="auto"><code class="notranslate">myapp.py</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from celery import Celery

app = Celery('myapp')
app.config_from_object(&quot;celeryconfig&quot;)


@app.task
def add_list(args):
    return sum(args)


if __name__ == '__main__':
    app.start()"><pre class="notranslate"><code class="notranslate">from celery import Celery

app = Celery('myapp')
app.config_from_object("celeryconfig")


@app.task
def add_list(args):
    return sum(args)


if __name__ == '__main__':
    app.start()
</code></pre></div>
<p dir="auto"><code class="notranslate">main.py</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from myapp import add_list, app
from celery.canvas import chord

app.config_from_object(&quot;celeryconfig&quot;)
promise = chord([add_list.s([2, 3]), add_list.s([4, 5])])(add_list.s())
print(promise.get())"><pre class="notranslate"><code class="notranslate">from myapp import add_list, app
from celery.canvas import chord

app.config_from_object("celeryconfig")
promise = chord([add_list.s([2, 3]), add_list.s([4, 5])])(add_list.s())
print(promise.get())
</code></pre></div>
<p dir="auto"></p>
</details>
<p dir="auto"><strong>Steps to reproduce</strong>:</p>
<ol dir="auto">
<li>Execute <code class="notranslate">docker run -d -p 5672:5672 rabbitmq</code> to start broker</li>
<li>Execute <code class="notranslate">docker run -d -p 5432:5432 postgres:11.4</code> for backend.</li>
<li>Run first worker with <code class="notranslate">celery -A myapp worker -l debug -Q high_priority_queue</code> in first terminal window</li>
<li>Run second worker with <code class="notranslate">celery -A myapp worker -l debug -Q low_priority_queue</code> in second terminal window</li>
<li>Run python3 -m main in third terminal window</li>
</ol>
<h1 dir="auto">Expected Behavior</h1>

<p dir="auto">All the tasks are routed to <code class="notranslate">high_priority_queue</code> and executed by the first worker.</p>
<h1 dir="auto">Actual Behavior</h1>
<p dir="auto"><code class="notranslate">celery.chord_unlock</code> task is routed to the default <code class="notranslate">low_priority_queue</code> and executed by the second worker.</p>