<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>
<ul dir="auto">
<li>Task invocation via <code class="notranslate">.delay()</code> not working, in our case is with django_templated_email</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>
<ul dir="auto">
<li>celery==4.3.0</li>
<li>django-celery-beat==1.5.0</li>
</ul>
<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="/usr/local/lib/python3.6/site-packages/celery/platforms.py:801: RuntimeWarning: You're running the worker with superuser privileges: this is
absolutely not recommended!

Please specify a different user using the --uid option.

User information: uid=0 euid=0 gid=0 egid=0

  uid=uid, euid=euid, gid=gid, egid=egid,
 
 -------------- celery@worker-deployment-695fbd498-rmln6 v4.3.0 (rhubarb)
---- **** ----- 
--- * ***  * -- Linux-4.14.138+-x86_64-with-debian-10.1 2019-11-12 17:00:00
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .&gt; app:         app:0x7f694a5ba160
- ** ---------- .&gt; transport:   redis://10.0.0.3:6379/0
- ** ---------- .&gt; results:     disabled://
- *** --- * --- .&gt; concurrency: 1 (prefork)
-- ******* ---- .&gt; task events: ON
--- ***** ----- 
 -------------- [queues]
                .&gt; celery           exchange=celery(direct) key=celery
                

[tasks]
  . accounting.tasks.generate_payment_receipt_by_collection_id
  . loans.tasks.send_loan_approval_email
  . loans.tasks.send_loan_approval_sms
  . loans.tasks.send_loan_disbursement_sms
  . loans.tasks.send_loan_rejection_email
  . loans.tasks.send_loan_rejection_sms
  . loans.tasks.send_loan_revision_sms
  . loans.tasks.update_repayments_by_loan_id

[2019-11-12 17:00:01,232: INFO/MainProcess] Connected to redis://10.0.0.3:6379/0
[2019-11-12 17:00:01,313: INFO/MainProcess] mingle: searching for neighbors
[2019-11-12 17:00:02,423: INFO/MainProcess] mingle: sync with 1 nodes
[2019-11-12 17:00:02,424: INFO/MainProcess] mingle: sync complete
[2019-11-12 17:00:02,510: WARNING/MainProcess] /usr/local/lib/python3.6/site-packages/celery/fixups/django.py:202: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments!
  warnings.warn('Using settings.DEBUG leads to a memory leak, never '
[2019-11-12 17:00:02,511: INFO/MainProcess] celery@worker-deployment-695fbd498-rmln6 ready.
[2019-11-12 17:00:27,433: INFO/MainProcess] missed heartbeat from celery@worker-deployment-594c7656c-llbh5
[2019-11-12 17:57:57,857: INFO/MainProcess] Received task: loans.tasks.send_loan_approval_sms[fbc8eefe-2155-4754-983a-2409ef2e544a]  
[2019-11-12 17:57:58,008: INFO/ForkPoolWorker-1] Running loans.tasks task
[2019-11-12 17:57:59,486: INFO/ForkPoolWorker-1] Successfully sent SMS
[2019-11-12 17:57:59,487: INFO/ForkPoolWorker-1] &lt;Response [200]&gt;
[2019-11-12 17:58:00,761: ERROR/ForkPoolWorker-1] An error occured when sending an SMS
[2019-11-12 17:58:00,762: ERROR/ForkPoolWorker-1] Traceback
[2019-11-12 17:58:00,765: ERROR/ForkPoolWorker-1] 400 Client Error:  for url: https://endpoint.api.infobip.com/sms/2/text/single
[2019-11-12 17:58:00,766: INFO/ForkPoolWorker-1] Task loans.tasks.send_loan_approval_sms[fbc8eefe-2155-4754-983a-2409ef2e544a] succeeded in 2.8980900809401646s: None
"><pre class="notranslate"><code class="notranslate">/usr/local/lib/python3.6/site-packages/celery/platforms.py:801: RuntimeWarning: You're running the worker with superuser privileges: this is
absolutely not recommended!

Please specify a different user using the --uid option.

User information: uid=0 euid=0 gid=0 egid=0

  uid=uid, euid=euid, gid=gid, egid=egid,
 
 -------------- celery@worker-deployment-695fbd498-rmln6 v4.3.0 (rhubarb)
---- **** ----- 
--- * ***  * -- Linux-4.14.138+-x86_64-with-debian-10.1 2019-11-12 17:00:00
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .&gt; app:         app:0x7f694a5ba160
- ** ---------- .&gt; transport:   redis://10.0.0.3:6379/0
- ** ---------- .&gt; results:     disabled://
- *** --- * --- .&gt; concurrency: 1 (prefork)
-- ******* ---- .&gt; task events: ON
--- ***** ----- 
 -------------- [queues]
                .&gt; celery           exchange=celery(direct) key=celery
                

[tasks]
  . accounting.tasks.generate_payment_receipt_by_collection_id
  . loans.tasks.send_loan_approval_email
  . loans.tasks.send_loan_approval_sms
  . loans.tasks.send_loan_disbursement_sms
  . loans.tasks.send_loan_rejection_email
  . loans.tasks.send_loan_rejection_sms
  . loans.tasks.send_loan_revision_sms
  . loans.tasks.update_repayments_by_loan_id

[2019-11-12 17:00:01,232: INFO/MainProcess] Connected to redis://10.0.0.3:6379/0
[2019-11-12 17:00:01,313: INFO/MainProcess] mingle: searching for neighbors
[2019-11-12 17:00:02,423: INFO/MainProcess] mingle: sync with 1 nodes
[2019-11-12 17:00:02,424: INFO/MainProcess] mingle: sync complete
[2019-11-12 17:00:02,510: WARNING/MainProcess] /usr/local/lib/python3.6/site-packages/celery/fixups/django.py:202: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments!
  warnings.warn('Using settings.DEBUG leads to a memory leak, never '
[2019-11-12 17:00:02,511: INFO/MainProcess] celery@worker-deployment-695fbd498-rmln6 ready.
[2019-11-12 17:00:27,433: INFO/MainProcess] missed heartbeat from celery@worker-deployment-594c7656c-llbh5
[2019-11-12 17:57:57,857: INFO/MainProcess] Received task: loans.tasks.send_loan_approval_sms[fbc8eefe-2155-4754-983a-2409ef2e544a]  
[2019-11-12 17:57:58,008: INFO/ForkPoolWorker-1] Running loans.tasks task
[2019-11-12 17:57:59,486: INFO/ForkPoolWorker-1] Successfully sent SMS
[2019-11-12 17:57:59,487: INFO/ForkPoolWorker-1] &lt;Response [200]&gt;
[2019-11-12 17:58:00,761: ERROR/ForkPoolWorker-1] An error occured when sending an SMS
[2019-11-12 17:58:00,762: ERROR/ForkPoolWorker-1] Traceback
[2019-11-12 17:58:00,765: ERROR/ForkPoolWorker-1] 400 Client Error:  for url: https://endpoint.api.infobip.com/sms/2/text/single
[2019-11-12 17:58:00,766: INFO/ForkPoolWorker-1] Task loans.tasks.send_loan_approval_sms[fbc8eefe-2155-4754-983a-2409ef2e544a] succeeded in 2.8980900809401646s: None

</code></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Steps to Reproduce</h1>
<p dir="auto">I encountered this issue when doing the following</p>
<ul dir="auto">
<li>I have a task definition like this</li>
</ul>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@shared_task
def send_loan_approval_email(loan_id):
    from loans.models import Loan
    from templated_email import get_templated_mail
    loan = Loan.objects.get(pk=loan_id)

    # some code here

    email_borrower.send()
    email_guarantor.send()

@shared_task
def send_loan_approval_sms(loan_id):
    from loans.models import Loan
    from app.services import sms_service
    loan = Loan.objects.get(pk=loan_id)
    log.info(f&quot;Running {__name__} task&quot;)
    sms_service.send(
      # some code here
    )"><pre class="notranslate"><span class="pl-en">@<span class="pl-s1">shared_task</span></span>
<span class="pl-k">def</span> <span class="pl-en">send_loan_approval_email</span>(<span class="pl-s1">loan_id</span>):
    <span class="pl-k">from</span> <span class="pl-s1">loans</span>.<span class="pl-s1">models</span> <span class="pl-k">import</span> <span class="pl-v">Loan</span>
    <span class="pl-k">from</span> <span class="pl-s1">templated_email</span> <span class="pl-k">import</span> <span class="pl-s1">get_templated_mail</span>
    <span class="pl-s1">loan</span> <span class="pl-c1">=</span> <span class="pl-v">Loan</span>.<span class="pl-s1">objects</span>.<span class="pl-en">get</span>(<span class="pl-s1">pk</span><span class="pl-c1">=</span><span class="pl-s1">loan_id</span>)

    <span class="pl-c"># some code here</span>

    <span class="pl-s1">email_borrower</span>.<span class="pl-en">send</span>()
    <span class="pl-s1">email_guarantor</span>.<span class="pl-en">send</span>()

<span class="pl-en">@<span class="pl-s1">shared_task</span></span>
<span class="pl-k">def</span> <span class="pl-en">send_loan_approval_sms</span>(<span class="pl-s1">loan_id</span>):
    <span class="pl-k">from</span> <span class="pl-s1">loans</span>.<span class="pl-s1">models</span> <span class="pl-k">import</span> <span class="pl-v">Loan</span>
    <span class="pl-k">from</span> <span class="pl-s1">app</span>.<span class="pl-s1">services</span> <span class="pl-k">import</span> <span class="pl-s1">sms_service</span>
    <span class="pl-s1">loan</span> <span class="pl-c1">=</span> <span class="pl-v">Loan</span>.<span class="pl-s1">objects</span>.<span class="pl-en">get</span>(<span class="pl-s1">pk</span><span class="pl-c1">=</span><span class="pl-s1">loan_id</span>)
    <span class="pl-s1">log</span>.<span class="pl-en">info</span>(<span class="pl-s">f"Running <span class="pl-s1"><span class="pl-kos">{</span><span class="pl-s1">__name__</span><span class="pl-kos">}</span></span> task"</span>)
    <span class="pl-s1">sms_service</span>.<span class="pl-en">send</span>(
      <span class="pl-c"># some code here</span>
    )</pre></div>
<ul dir="auto">
<li>I have code invocation here</li>
</ul>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Loan:
    def approve(self, by=None):
        send_loan_approval_sms.delay(self.id)
        send_loan_approval_email.delay(self.id)"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">Loan</span>:
    <span class="pl-k">def</span> <span class="pl-en">approve</span>(<span class="pl-s1">self</span>, <span class="pl-s1">by</span><span class="pl-c1">=</span><span class="pl-c1">None</span>):
        <span class="pl-s1">send_loan_approval_sms</span>.<span class="pl-en">delay</span>(<span class="pl-s1">self</span>.<span class="pl-s1">id</span>)
        <span class="pl-s1">send_loan_approval_email</span>.<span class="pl-en">delay</span>(<span class="pl-s1">self</span>.<span class="pl-s1">id</span>)</pre></div>
<ul dir="auto">
<li>When I run <code class="notranslate">approve()</code> somehow the sms run but the email doesn't, but sometime it works too, sms consistently running, but the email sometime work sometime broken. Any idea why?</li>
</ul>
<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="asn1crypto==0.24.0
backports.ssl-match-hostname==3.7.0.1
bcrypt==3.1.6
cached-property==1.5.1
certifi==2019.3.9
cffi==1.12.3
chardet==3.0.4
cryptography==2.6.1
Django==1.11.26
django-storages==1.7.2
docker==3.7.2
docker-compose==1.24.0
docker-pycreds==0.4.0
dockerpty==0.4.1
docopt==0.6.2
enum34==1.1.6
functools32==3.2.3.post2
idna==2.7
ipaddress==1.0.22
jsonschema==2.6.0
paramiko==2.4.2
pyasn1==0.4.5
pycparser==2.19
PyNaCl==1.3.0
pytz==2019.3
PyYAML==3.13
requests==2.20.1
six==1.12.0
texttable==0.9.1
urllib3==1.24.2
websocket-client==0.56.0
"><pre class="notranslate"><code class="notranslate">asn1crypto==0.24.0
backports.ssl-match-hostname==3.7.0.1
bcrypt==3.1.6
cached-property==1.5.1
certifi==2019.3.9
cffi==1.12.3
chardet==3.0.4
cryptography==2.6.1
Django==1.11.26
django-storages==1.7.2
docker==3.7.2
docker-compose==1.24.0
docker-pycreds==0.4.0
dockerpty==0.4.1
docopt==0.6.2
enum34==1.1.6
functools32==3.2.3.post2
idna==2.7
ipaddress==1.0.22
jsonschema==2.6.0
paramiko==2.4.2
pyasn1==0.4.5
pycparser==2.19
PyNaCl==1.3.0
pytz==2019.3
PyYAML==3.13
requests==2.20.1
six==1.12.0
texttable==0.9.1
urllib3==1.24.2
websocket-client==0.56.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=""><pre class="notranslate"></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<p dir="auto">Both <code class="notranslate">send_loan_approval_sms</code> and <code class="notranslate">send_loan_approval_email</code> should emitted to worker.</p>
<h1 dir="auto">Actual Behavior</h1>

<p dir="auto">Only <code class="notranslate">send_loan_approval_sms</code> emitted to worker.</p>
<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 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"> 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"> 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>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> 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>: 4.4.2</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="(base) C:\Users\headmaster\Desktop\WEB&gt;celery -A tasks report

software -&gt; celery:4.4.2 (cliffs) kombu:4.6.8 py:3.7.4
            billiard:3.6.3.0 redis:3.4.1
platform -&gt; system:Windows arch:64bit, WindowsPE
            kernel version:10 imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:redis results:redis://localhost:6379/1

broker_url: 'redis://localhost:6379/0'
result_backend: 'redis://localhost:6379/1'
"><pre class="notranslate"><code class="notranslate">(base) C:\Users\headmaster\Desktop\WEB&gt;celery -A tasks report

software -&gt; celery:4.4.2 (cliffs) kombu:4.6.8 py:3.7.4
            billiard:3.6.3.0 redis:3.4.1
platform -&gt; system:Windows arch:64bit, WindowsPE
            kernel version:10 imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:redis results:redis://localhost:6379/1

broker_url: 'redis://localhost:6379/0'
result_backend: 'redis://localhost:6379/1'

</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.7</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>: win10</li>
<li><strong>Minimal Broker Client Version</strong>:  Redis 3.2.100</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><div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<p dir="auto">I was trying to add Celery asychronized feature to my simple flask web project as a flask beginner. After managing to install and launching celery, redis and related python pip thing, I got struggling with the delay() in the very beginning. It seemed I could not even get into the delay(). I am so frustrated, could you help me please?</p>
<p dir="auto">I have app.py and tasks.py under my flask project. (At first I wrote everything in app.py, then I split the celery object out, which didn't help)</p>
<p dir="auto">tasks.py:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from celery import Celery

celery = Celery('app', broker='redis://localhost:6379/0', backend='redis://localhost:6379/1')


@celery.task
def modeling_task():
    print('yes')
    "><pre class="notranslate"><code class="notranslate">from celery import Celery

celery = Celery('app', broker='redis://localhost:6379/0', backend='redis://localhost:6379/1')


@celery.task
def modeling_task():
    print('yes')
    
</code></pre></div>
<p dir="auto">app.py:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@app.route('/train', methods=['GET', 'POST'])
def train():
    if request.method == &quot;GET&quot;:
        return render_template('train.html')
    else:  # when request POST
        # check if the post request has the file part
        if 'file' not in request.files:
            return jsonify({&quot;code&quot;: 500, &quot;status&quot;: 'No file is uploaded!'})

        if file and allowed_file(file.filename):
            print(request.files['file'].filename)
            print('before task')
            task = modeling_task.delay()
            print('after task')
            
            return jsonify({&quot;code&quot;: 200, &quot;status&quot;: 'model training', &quot;task_id&quot;: task.id})

        return 'Uploading file is wrong'"><pre class="notranslate"><code class="notranslate">@app.route('/train', methods=['GET', 'POST'])
def train():
    if request.method == "GET":
        return render_template('train.html')
    else:  # when request POST
        # check if the post request has the file part
        if 'file' not in request.files:
            return jsonify({"code": 500, "status": 'No file is uploaded!'})

        if file and allowed_file(file.filename):
            print(request.files['file'].filename)
            print('before task')
            task = modeling_task.delay()
            print('after task')
            
            return jsonify({"code": 200, "status": 'model training', "task_id": task.id})

        return 'Uploading file is wrong'
</code></pre></div>
<p dir="auto">If things work well, after the server receives a uploading file, the print results on console should be</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Car_TEST.csv
before task
yes
after task"><pre class="notranslate"><code class="notranslate">Car_TEST.csv
before task
yes
after task
</code></pre></div>
<h1 dir="auto">Actual Behavior</h1>

<p dir="auto">However, the console result is simply this</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" * Detected change in 'C:\\Users\\headmaster\\Desktop\\WEB\\tasks.py', reloading
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 308-608-393
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [22/Apr/2020 11:39:22] &quot;GET /train HTTP/1.1&quot; 200 -
Car_TEST.csv
before task
"><pre class="notranslate"><code class="notranslate"> * Detected change in 'C:\\Users\\headmaster\\Desktop\\WEB\\tasks.py', reloading
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 308-608-393
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [22/Apr/2020 11:39:22] "GET /train HTTP/1.1" 200 -
Car_TEST.csv
before task

</code></pre></div>
<p dir="auto">and the server got stuck in here, keeping enlessly running.</p>
<p dir="auto">So it seems the server don't even run the "task = modeling_task.delay()", otherwise it should've print "yes" on the console, right?</p>
<p dir="auto">Would it print "yes" in another place? Why did it get stuck?</p>
<p dir="auto">Down below is the celery info:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="(base) C:\Users\headmaster\Desktop\WEB&gt;celery worker -A tasks.celery --loglevel=info

 -------------- celery@LAPTOP-KLKJCK2F v4.4.2 (cliffs)
--- ***** -----
-- ******* ---- Windows-10-10.0.18362-SP0 2020-04-22 10:55:13
- *** --- * ---
- ** ---------- [config]
- ** ---------- .&gt; app:         app:0x2526977ac08
- ** ---------- .&gt; transport:   redis://localhost:6379/0
- ** ---------- .&gt; results:     redis://localhost:6379/1
- *** --- * --- .&gt; concurrency: 4 (prefork)
-- ******* ---- .&gt; task events: OFF (enable -E to monitor tasks in this worker)
--- ***** -----
 -------------- [queues]
                .&gt; celery           exchange=celery(direct) key=celery


[tasks]
  . tasks.modeling_task

[2020-04-22 10:55:15,501: INFO/SpawnPoolWorker-1] child process 6692 calling self.run()
[2020-04-22 10:55:15,511: INFO/SpawnPoolWorker-2] child process 17736 calling self.run()
[2020-04-22 10:55:15,518: INFO/SpawnPoolWorker-3] child process 16320 calling self.run()
[2020-04-22 10:55:15,571: INFO/SpawnPoolWorker-4] child process 5608 calling self.run()
[2020-04-22 10:55:15,972: INFO/MainProcess] Connected to redis://localhost:6379/0
[2020-04-22 10:55:20,332: INFO/MainProcess] mingle: searching for neighbors
[2020-04-22 10:55:27,369: INFO/MainProcess] mingle: all alone
[2020-04-22 10:55:35,402: INFO/MainProcess] celery@LAPTOP-KLKJCK2F ready."><pre class="notranslate"><code class="notranslate">(base) C:\Users\headmaster\Desktop\WEB&gt;celery worker -A tasks.celery --loglevel=info

 -------------- celery@LAPTOP-KLKJCK2F v4.4.2 (cliffs)
--- ***** -----
-- ******* ---- Windows-10-10.0.18362-SP0 2020-04-22 10:55:13
- *** --- * ---
- ** ---------- [config]
- ** ---------- .&gt; app:         app:0x2526977ac08
- ** ---------- .&gt; transport:   redis://localhost:6379/0
- ** ---------- .&gt; results:     redis://localhost:6379/1
- *** --- * --- .&gt; concurrency: 4 (prefork)
-- ******* ---- .&gt; task events: OFF (enable -E to monitor tasks in this worker)
--- ***** -----
 -------------- [queues]
                .&gt; celery           exchange=celery(direct) key=celery


[tasks]
  . tasks.modeling_task

[2020-04-22 10:55:15,501: INFO/SpawnPoolWorker-1] child process 6692 calling self.run()
[2020-04-22 10:55:15,511: INFO/SpawnPoolWorker-2] child process 17736 calling self.run()
[2020-04-22 10:55:15,518: INFO/SpawnPoolWorker-3] child process 16320 calling self.run()
[2020-04-22 10:55:15,571: INFO/SpawnPoolWorker-4] child process 5608 calling self.run()
[2020-04-22 10:55:15,972: INFO/MainProcess] Connected to redis://localhost:6379/0
[2020-04-22 10:55:20,332: INFO/MainProcess] mingle: searching for neighbors
[2020-04-22 10:55:27,369: INFO/MainProcess] mingle: all alone
[2020-04-22 10:55:35,402: INFO/MainProcess] celery@LAPTOP-KLKJCK2F ready.
</code></pre></div>
<p dir="auto">redis info:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PS D:\Applications\Redis&gt; redis-server redis.conf
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 3.2.100 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 21420
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

[21420] 22 Apr 10:38:22.506 # Server started, Redis version 3.2.100
[21420] 22 Apr 10:38:22.508 * DB loaded from disk: 0.000 seconds
[21420] 22 Apr 10:38:22.508 * The server is now ready to accept connections on port 6379
[21420] 22 Apr 10:43:23.025 * 10 changes in 300 seconds. Saving...
[21420] 22 Apr 10:43:23.030 * Background saving started by pid 6204
[21420] 22 Apr 10:43:23.231 # fork operation complete
[21420] 22 Apr 10:43:23.232 * Background saving terminated with success
[21420] 22 Apr 10:51:18.099 * 10 changes in 300 seconds. Saving...
[21420] 22 Apr 10:51:18.103 * Background saving started by pid 10116
[21420] 22 Apr 10:51:18.305 # fork operation complete
[21420] 22 Apr 10:51:18.306 * Background saving terminated with success
[21420] 22 Apr 10:56:19.022 * 10 changes in 300 seconds. Saving...
[21420] 22 Apr 10:56:19.026 * Background saving started by pid 11748
[21420] 22 Apr 10:56:19.227 # fork operation complete
[21420] 22 Apr 10:56:19.227 * Background saving terminated with success"><pre class="notranslate"><code class="notranslate">PS D:\Applications\Redis&gt; redis-server redis.conf
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 3.2.100 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 21420
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

[21420] 22 Apr 10:38:22.506 # Server started, Redis version 3.2.100
[21420] 22 Apr 10:38:22.508 * DB loaded from disk: 0.000 seconds
[21420] 22 Apr 10:38:22.508 * The server is now ready to accept connections on port 6379
[21420] 22 Apr 10:43:23.025 * 10 changes in 300 seconds. Saving...
[21420] 22 Apr 10:43:23.030 * Background saving started by pid 6204
[21420] 22 Apr 10:43:23.231 # fork operation complete
[21420] 22 Apr 10:43:23.232 * Background saving terminated with success
[21420] 22 Apr 10:51:18.099 * 10 changes in 300 seconds. Saving...
[21420] 22 Apr 10:51:18.103 * Background saving started by pid 10116
[21420] 22 Apr 10:51:18.305 # fork operation complete
[21420] 22 Apr 10:51:18.306 * Background saving terminated with success
[21420] 22 Apr 10:56:19.022 * 10 changes in 300 seconds. Saving...
[21420] 22 Apr 10:56:19.026 * Background saving started by pid 11748
[21420] 22 Apr 10:56:19.227 # fork operation complete
[21420] 22 Apr 10:56:19.227 * Background saving terminated with success
</code></pre></div>
<p dir="auto">wish you a best day!</p>