<p dir="auto">from celery import Celeryapp = Celery()app.conf.update (    enable_utc=True,    timezone='UTC')app.conf.beat_schedule = {    'test': {        'task': 'test',        'schedule': 5,    }}@app.task(bind=True, name='test')def test(self):    if self.app.finalized:        raise ValueError("APP finalized.")</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" 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>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>: v4.3.0</p>

<details>
<summary><b><code class="notranslate">celery -A example worker -B -E --loglevel=info</code> Output:</b></summary>
<p dir="auto">
</p><p dir="auto">-------------- celery@user v4.3.0 (rhubarb)<br>
---- **** -----<br>
--- * ***  * -- Linux-5.2.11-100.fc29.x86_64-x86_64-with-fedora-29-Twenty_Nine 2019-09-19 16:57:03<br>
-- * - **** ---</p>
<ul dir="auto">
<li>** ---------- [config]</li>
<li>** ---------- .&gt; app:         <strong>main</strong>:0x7f88ce002978</li>
<li>** ---------- .&gt; transport:   amqp://guest:**<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//</li>
<li>** ---------- .&gt; results:     disabled://</li>
<li>*** --- * --- .&gt; concurrency: 4 (prefork)<br>
-- ******* ---- .&gt; task events: ON<br>
--- ***** -----<br>
-------------- [queues]<br>
.&gt; celery           exchange=celery(direct) key=celery</li>
</ul>
<p dir="auto">[tasks]<br>
. test</p>
<p dir="auto">[2019-09-19 16:57:03,962: INFO/Beat] beat: Starting...<br>
[2019-09-19 16:57:03,993: INFO/Beat] Scheduler: Sending due task test (test)<br>
[2019-09-19 16:57:04,083: INFO/MainProcess] Connected to amqp://guest:**@127.0.0.1:5672//<br>
[2019-09-19 16:57:04,096: INFO/MainProcess] mingle: searching for neighbors<br>
[2019-09-19 16:57:05,149: INFO/MainProcess] mingle: all alone<br>
[2019-09-19 16:57:05,186: INFO/MainProcess] celery@user ready.<br>
[2019-09-19 16:57:05,186: INFO/MainProcess] Received task: test[73cb77be-6111-4a61-a882-32b4ccd7890e]<br>
[2019-09-19 16:57:05,290: ERROR/ForkPoolWorker-5] Task test[73cb77be-6111-4a61-a882-32b4ccd7890e] raised unexpected: ValueError('APP finalized.',)<br>
Traceback (most recent call last):<br>
File "/misc-VAl3-rUJ/lib/python3.6/site-packages/celery/app/trace.py", line 385, in trace_task<br>
R = retval = fun(*args, **kwargs)<br>
File "/misc-VAl3-rUJ/lib/python3.6/site-packages/celery/app/trace.py", line 648, in <strong>protected_call</strong><br>
return self.run(*args, **kwargs)<br>
File "/home/.../example.py", line 19, in test<br>
raise ValueError("APP finalized.")<br>
ValueError: APP finalized.</p>
<p dir="auto"></p>
</details>
<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="-i https://pypi.org/simple
amqp==2.5.1
billiard==3.6.1.0
celery==4.3.0
importlib-metadata==0.23
kombu==4.6.4
more-itertools==7.2.0
pytz==2019.2
vine==1.3.0
zipp==0.6.0"><pre class="notranslate"><code class="notranslate">-i https://pypi.org/simple
amqp==2.5.1
billiard==3.6.1.0
celery==4.3.0
importlib-metadata==0.23
kombu==4.6.4
more-itertools==7.2.0
pytz==2019.2
vine==1.3.0
zipp==0.6.0
</code></pre></div>
<p dir="auto"></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 celery import Celery

app = Celery()
app.conf.update (
    enable_utc=True,
    timezone='UTC')

app.conf.beat_schedule = {
    'test': {
        'task': 'test',
        'schedule': 5,
    }
}


@app.task(bind=True, name='test')
def test(self):
    if self.app.finalized:
        raise ValueError(&quot;APP finalized.&quot;)"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">celery</span> <span class="pl-k">import</span> <span class="pl-v">Celery</span>

<span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-v">Celery</span>()
<span class="pl-s1">app</span>.<span class="pl-s1">conf</span>.<span class="pl-en">update</span> (
    <span class="pl-s1">enable_utc</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
    <span class="pl-s1">timezone</span><span class="pl-c1">=</span><span class="pl-s">'UTC'</span>)

<span class="pl-s1">app</span>.<span class="pl-s1">conf</span>.<span class="pl-s1">beat_schedule</span> <span class="pl-c1">=</span> {
    <span class="pl-s">'test'</span>: {
        <span class="pl-s">'task'</span>: <span class="pl-s">'test'</span>,
        <span class="pl-s">'schedule'</span>: <span class="pl-c1">5</span>,
    }
}


<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 class="pl-s1">name</span><span class="pl-c1">=</span><span class="pl-s">'test'</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">test</span>(<span class="pl-s1">self</span>):
    <span class="pl-k">if</span> <span class="pl-s1">self</span>.<span class="pl-s1">app</span>.<span class="pl-s1">finalized</span>:
        <span class="pl-k">raise</span> <span class="pl-v">ValueError</span>(<span class="pl-s">"APP finalized."</span>)</pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<p dir="auto">I expected that the app.finalized be false, once that the app itself is running this task.</p>
<h1 dir="auto">Actual Behavior</h1>

<p dir="auto">Flag is True</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" 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"> 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" 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"> 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" checked=""> 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><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="268480260" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/4341" data-hovercard-type="issue" data-hovercard-url="/celery/celery/issues/4341/hovercard" href="https://github.com/celery/celery/issues/4341">#4341</a></li>
</ul>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="268480260" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/4341" data-hovercard-type="issue" data-hovercard-url="/celery/celery/issues/4341/hovercard" href="https://github.com/celery/celery/issues/4341">#4341</a></li>
</ul>
<h2 dir="auto">Environment &amp; Settings</h2>

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

<details>
<summary><b><code class="notranslate">celery report</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><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">
</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>

<h1 dir="auto">Actual Behavior</h1>

<p dir="auto">We are using <code class="notranslate">celery==4.3.0</code> and seeing the exact same closed issue at <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="268480260" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/4341" data-hovercard-type="issue" data-hovercard-url="/celery/celery/issues/4341/hovercard" href="https://github.com/celery/celery/issues/4341">#4341</a></p>
<p dir="auto">Essentially, the exponential backoff retry is defaulting to 180s: <code class="notranslate">Retry in 180s</code>.</p>
<p dir="auto">Has this feature actually been implemented in Celery?</p>