<p dir="auto">Configuration<br>
Django 1.3.1 non-rel<br>
celery==3.0.19</p>
<p dir="auto">django-celery==3.0.17<br>
celery-haystack==0.7.2</p>
<p dir="auto">Log from celery server</p>
<p dir="auto">-------------- celery@laptop v3.0.19 (Chiastic Slide)<br>
---- **** -----<br>
--- * ***  * -- Windows-7-6.1.7601-SP1<br>
-- * - **** ---</p>
<ul dir="auto">
<li>** ---------- [config]</li>
<li>** ---------- .&gt; broker:      redis://127.0.0.1:6379/0</li>
<li>** ---------- .&gt; app:         default:0x2b07d70 (djcelery.loaders.DjangoLoader)</li>
<li>** ---------- .&gt; concurrency: 4 (processes)</li>
<li>*** --- * --- .&gt; events:      ON<br>
-- ******* ----<br>
--- ***** ----- [queues]<br>
-------------- .&gt; celery:      exchange:celery(direct) binding:celery</li>
</ul>
<p dir="auto">[Tasks]<br>
. celery.backend_cleanup<br>
. celery.chain<br>
. celery.chord<br>
. celery.chord_unlock<br>
. celery.chunks<br>
. celery.group<br>
. celery.map<br>
. celery.starmap<br>
. celery_haystack.tasks.CeleryHaystackSignalHandler<br>
. celery_haystack.tasks.CeleryHaystackUpdateIndex</p>
<p dir="auto">......<br>
......<br>
....</p>
<p dir="auto">[2013-06-12 00:11:10,713: INFO/MainProcess] Got task from broker: celery_haystack.tasks.CeleryHaysta<br>
[2013-06-12 00:11:10,733: DEBUG/MainProcess] Mediator: Running callback for task: celery_haystack.ta<br>
[2013-06-12 00:11:10,733: DEBUG/MainProcess] TaskPool: Apply &lt;function _fast_trace_task at 0x0408C6B<br>
[2013-06-12 00:11:10,737: DEBUG/MainProcess] Task accepted: celery_haystack.tasks.CeleryHaystackSign<br>
[2013-06-12 00:11:10,846: ERROR/MainProcess] Task celery_haystack.tasks.CeleryHaystackSignalHandler[<br>
Traceback (most recent call last):<br>
File "C:\Python27\lib\site-packages\billiard\pool.py", line 313, in worker<br>
result = (True, func(_args, *_kwds))<br>
File "C:\Python27\lib\site-packages\celery\task\trace.py", line 320, in _fast_trace_task<br>
return _tasks[task].<strong>trace</strong>(uuid, args, kwargs, request)[0]<br>
File "C:\Python27\lib\site-packages\celery\app\registry.py", line 20, in <strong>missing</strong><br>
raise self.NotRegistered(key)<br>
NotRegistered: 'celery_haystack.tasks.CeleryHaystackSignalHandler'</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" 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"> I have tried reproducing the issue on more than one version of the message<br>
broker and/or result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one operating system.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one workers pool.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue with autoscaling, retries,<br>
ETA/Countdown &amp; rate limits disabled.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have tried reproducing the issue after downgrading<br>
and/or upgrading Celery and its dependencies.</li>
</ul>
<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="188921722" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/3586" data-hovercard-type="issue" data-hovercard-url="/celery/celery/issues/3586/hovercard" href="https://github.com/celery/celery/issues/3586">#3586</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="188921722" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/3586" data-hovercard-type="issue" data-hovercard-url="/celery/celery/issues/3586/hovercard" href="https://github.com/celery/celery/issues/3586">#3586</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="software -&gt; celery:4.4.0rc2 (cliffs) kombu:4.6.3 py:3.6.7
            billiard:3.6.0.0 py-amqp:2.5.0
platform -&gt; system:Linux arch:64bit
            kernel version:4.9.125-linuxkit imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:pyamqp results:redis://redis/

broker_url: 'amqp://guest:********@rabbit:5672//'
result_backend: 'redis://redis/'"><pre class="notranslate"><code class="notranslate">software -&gt; celery:4.4.0rc2 (cliffs) kombu:4.6.3 py:3.6.7
            billiard:3.6.0.0 py-amqp:2.5.0
platform -&gt; system:Linux arch:64bit
            kernel version:4.9.125-linuxkit imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:pyamqp results:redis://redis/

broker_url: 'amqp://guest:********@rabbit:5672//'
result_backend: 'redis://redis/'
</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="alabaster==0.7.12
amqp==2.5.0
asn1crypto==0.24.0
aspy.yaml==1.3.0
atomicwrites==1.3.0
attrs==19.1.0
aws-xray-sdk==0.95
azure-common==1.1.5
azure-nspkg==3.0.2
azure-storage==0.36.0
azure-storage-common==1.1.0
azure-storage-nspkg==3.1.0
Babel==2.7.0
basho-erlastic==2.1.1
billiard==3.6.0.0
boto==2.49.0
boto3==1.9.180
botocore==1.12.180
bumpversion==0.5.3
case==1.5.3
cassandra-driver==3.18.0
celery==4.4.0rc2
certifi==2019.6.16
cffi==1.12.3
cfgv==2.0.0
chardet==3.0.4
codecov==2.0.15
couchbase==2.5.5
coverage==4.5.3
cryptography==2.7
DateTime==4.3
dnspython==1.16.0
docker==4.0.2
docutils==0.14
ecdsa==0.13.2
elasticsearch==7.0.2
entrypoints==0.3
ephem==3.7.6.0
eventlet==0.25.0
filelock==3.0.12
flake8==3.7.7
flakeplus==1.1.0
future==0.17.1
gevent==1.4.0
greenlet==0.4.15
identify==1.4.5
idna==2.8
imagesize==1.1.0
importlib-metadata==0.18
importlib-resources==1.0.2
Jinja2==2.10.1
jmespath==0.9.4
jsondiff==1.1.1
jsonpickle==1.2
kombu==4.6.3
linecache2==1.0.0
MarkupSafe==1.1.1
mccabe==0.6.1
mock==3.0.5
monotonic==1.5
more-itertools==7.1.0
moto==1.3.7
msgpack==0.6.1
nodeenv==1.3.3
nose==1.3.7
packaging==19.0
pluggy==0.12.0
pre-commit==1.17.0
py==1.8.0
pyaml==19.4.1
pyArango==1.3.2
pycodestyle==2.5.0
pycouchdb==1.14
pycparser==2.19
pycryptodome==3.8.2
pycurl==7.43.0.3
pydocstyle==1.1.1
pydocumentdb==2.3.2
pyflakes==2.1.1
Pygments==2.4.2
pylibmc==1.6.0
pymongo==3.8.0
pyparsing==2.4.0
pytest==4.6.4
pytest-cov==2.7.1
pytest-sugar==0.9.2
pytest-travis-fold==1.3.0
python-consul==1.1.0
python-dateutil==2.8.0
python-jose==2.0.2
python-memcached==1.59
python3-protobuf==2.5.0
pytz==2019.1
PyYAML==5.1.1
redis==3.2.1
requests==2.22.0
responses==0.10.6
riak==2.7.0
s3transfer==0.2.1
simplejson==3.16.0
six==1.12.0
snowballstemmer==1.9.0
softlayer-messaging==1.0.3
Sphinx==1.8.5
sphinx-celery==1.4.6
sphinx-testing==0.7.2
sphinx2rst==1.1.0
sphinxcontrib-websupport==1.1.2
SQLAlchemy==1.3.5
tblib==1.4.0
tenacity==5.0.4
termcolor==1.1.0
toml==0.10.0
tox==3.13.1
traceback2==1.4.0
typing==3.7.4
Unipath==1.1
unittest2==1.1.0
urllib3==1.25.3
vine==1.3.0
virtualenv==16.6.1
wcwidth==0.1.7
websocket-client==0.56.0
Werkzeug==0.15.4
wrapt==1.11.2
xmltodict==0.12.0
zipp==0.5.1
zope.interface==4.6.0"><pre class="notranslate"><code class="notranslate">alabaster==0.7.12
amqp==2.5.0
asn1crypto==0.24.0
aspy.yaml==1.3.0
atomicwrites==1.3.0
attrs==19.1.0
aws-xray-sdk==0.95
azure-common==1.1.5
azure-nspkg==3.0.2
azure-storage==0.36.0
azure-storage-common==1.1.0
azure-storage-nspkg==3.1.0
Babel==2.7.0
basho-erlastic==2.1.1
billiard==3.6.0.0
boto==2.49.0
boto3==1.9.180
botocore==1.12.180
bumpversion==0.5.3
case==1.5.3
cassandra-driver==3.18.0
celery==4.4.0rc2
certifi==2019.6.16
cffi==1.12.3
cfgv==2.0.0
chardet==3.0.4
codecov==2.0.15
couchbase==2.5.5
coverage==4.5.3
cryptography==2.7
DateTime==4.3
dnspython==1.16.0
docker==4.0.2
docutils==0.14
ecdsa==0.13.2
elasticsearch==7.0.2
entrypoints==0.3
ephem==3.7.6.0
eventlet==0.25.0
filelock==3.0.12
flake8==3.7.7
flakeplus==1.1.0
future==0.17.1
gevent==1.4.0
greenlet==0.4.15
identify==1.4.5
idna==2.8
imagesize==1.1.0
importlib-metadata==0.18
importlib-resources==1.0.2
Jinja2==2.10.1
jmespath==0.9.4
jsondiff==1.1.1
jsonpickle==1.2
kombu==4.6.3
linecache2==1.0.0
MarkupSafe==1.1.1
mccabe==0.6.1
mock==3.0.5
monotonic==1.5
more-itertools==7.1.0
moto==1.3.7
msgpack==0.6.1
nodeenv==1.3.3
nose==1.3.7
packaging==19.0
pluggy==0.12.0
pre-commit==1.17.0
py==1.8.0
pyaml==19.4.1
pyArango==1.3.2
pycodestyle==2.5.0
pycouchdb==1.14
pycparser==2.19
pycryptodome==3.8.2
pycurl==7.43.0.3
pydocstyle==1.1.1
pydocumentdb==2.3.2
pyflakes==2.1.1
Pygments==2.4.2
pylibmc==1.6.0
pymongo==3.8.0
pyparsing==2.4.0
pytest==4.6.4
pytest-cov==2.7.1
pytest-sugar==0.9.2
pytest-travis-fold==1.3.0
python-consul==1.1.0
python-dateutil==2.8.0
python-jose==2.0.2
python-memcached==1.59
python3-protobuf==2.5.0
pytz==2019.1
PyYAML==5.1.1
redis==3.2.1
requests==2.22.0
responses==0.10.6
riak==2.7.0
s3transfer==0.2.1
simplejson==3.16.0
six==1.12.0
snowballstemmer==1.9.0
softlayer-messaging==1.0.3
Sphinx==1.8.5
sphinx-celery==1.4.6
sphinx-testing==0.7.2
sphinx2rst==1.1.0
sphinxcontrib-websupport==1.1.2
SQLAlchemy==1.3.5
tblib==1.4.0
tenacity==5.0.4
termcolor==1.1.0
toml==0.10.0
tox==3.13.1
traceback2==1.4.0
typing==3.7.4
Unipath==1.1
unittest2==1.1.0
urllib3==1.25.3
vine==1.3.0
virtualenv==16.6.1
wcwidth==0.1.7
websocket-client==0.56.0
Werkzeug==0.15.4
wrapt==1.11.2
xmltodict==0.12.0
zipp==0.5.1
zope.interface==4.6.0
</code></pre></div>
<p dir="auto"></p>
</details>
<h3 dir="auto">Other Dependencies</h3>

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

<details>
<p dir="auto">
</p><div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from celery import Celery
from tenacity import retry, stop_after_attempt, wait_fixed

app = Celery('tasks', broker='pyamqp://rabbit:5672', backend='redis://redis/')

@retry(reraise=False, stop=stop_after_attempt(2), wait=wait_fixed(1))
def foo(x):
    print('attempt foo')
    raise ValueError('this is value error')

@app.task
def add(x, y):
    foo(x)
    return x + y"><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-k">from</span> <span class="pl-s1">tenacity</span> <span class="pl-k">import</span> <span class="pl-s1">retry</span>, <span class="pl-s1">stop_after_attempt</span>, <span class="pl-s1">wait_fixed</span>

<span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-v">Celery</span>(<span class="pl-s">'tasks'</span>, <span class="pl-s1">broker</span><span class="pl-c1">=</span><span class="pl-s">'pyamqp://rabbit:5672'</span>, <span class="pl-s1">backend</span><span class="pl-c1">=</span><span class="pl-s">'redis://redis/'</span>)

<span class="pl-en">@<span class="pl-en">retry</span>(<span class="pl-s1">reraise</span><span class="pl-c1">=</span><span class="pl-c1">False</span>, <span class="pl-s1">stop</span><span class="pl-c1">=</span><span class="pl-en">stop_after_attempt</span>(<span class="pl-c1">2</span>), <span class="pl-s1">wait</span><span class="pl-c1">=</span><span class="pl-en">wait_fixed</span>(<span class="pl-c1">1</span>))</span>
<span class="pl-k">def</span> <span class="pl-en">foo</span>(<span class="pl-s1">x</span>):
    <span class="pl-en">print</span>(<span class="pl-s">'attempt foo'</span>)
    <span class="pl-k">raise</span> <span class="pl-v">ValueError</span>(<span class="pl-s">'this is value error'</span>)

<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-s1">task</span></span>
<span class="pl-k">def</span> <span class="pl-en">add</span>(<span class="pl-s1">x</span>, <span class="pl-s1">y</span>):
    <span class="pl-en">foo</span>(<span class="pl-s1">x</span>)
    <span class="pl-k">return</span> <span class="pl-s1">x</span> <span class="pl-c1">+</span> <span class="pl-s1">y</span></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<p dir="auto">Running the <code class="notranslate">add</code> task should result in the following output</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="attempt foo
attempt foo
Traceback (most recent call last):
  File &quot;/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/tenacity/__init__.py&quot;, line 361, in call
    result = fn(*args, **kwargs)
  File &quot;/home/developer/celery/tasks.py&quot;, line 15, in foo
    foo(x)
ValueError: this is value error

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/home/developer/celery/celery/local.py&quot;, line 191, in __call__
    return self._get_current_object()(*a, **kw)
  File &quot;/home/developer/celery/celery/app/task.py&quot;, line 400, in __call__
    return self.run(*args, **kwargs)
  File &quot;/home/developer/celery/tasks.py&quot;, line 21, in add
  File &quot;/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/tenacity/__init__.py&quot;, line 292, in wrapped_f
    return self.call(f, *args, **kw)
  File &quot;/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/tenacity/__init__.py&quot;, line 358, in call
    do = self.iter(retry_state=retry_state)
  File &quot;/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/tenacity/__init__.py&quot;, line 332, in iter
    six.raise_from(retry_exc, fut.exception())
  File &quot;&lt;string&gt;&quot;, line 3, in raise_from
tenacity.RetryError: RetryError[&lt;Future at 0x7fe83b4c4240 state=finished raised ValueError&gt;]"><pre class="notranslate"><span class="pl-s1">attempt</span> <span class="pl-s1">foo</span>
<span class="pl-s1">attempt</span> <span class="pl-s1">foo</span>
<span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/tenacity/__init__.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">361</span>, <span class="pl-s1">in</span> <span class="pl-s1">call</span>
    <span class="pl-s1">result</span> <span class="pl-c1">=</span> <span class="pl-en">fn</span>(<span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/celery/tasks.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">15</span>, <span class="pl-s1">in</span> <span class="pl-s1">foo</span>
    <span class="pl-en">foo</span>(<span class="pl-s1">x</span>)
<span class="pl-v">ValueError</span>: <span class="pl-s1">this</span> <span class="pl-c1">is</span> <span class="pl-s1">value</span> <span class="pl-s1">error</span>

<span class="pl-v">The</span> <span class="pl-s1">above</span> <span class="pl-s1">exception</span> <span class="pl-s1">was</span> <span class="pl-s1">the</span> <span class="pl-s1">direct</span> <span class="pl-s1">cause</span> <span class="pl-s1">of</span> <span class="pl-s1">the</span> <span class="pl-s1">following</span> <span class="pl-s1">exception</span>:

<span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"&lt;stdin&gt;"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1</span>, <span class="pl-c1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/celery/celery/local.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">191</span>, <span class="pl-s1">in</span> <span class="pl-s1">__call__</span>
    <span class="pl-k">return</span> <span class="pl-s1">self</span>.<span class="pl-en">_get_current_object</span>()(<span class="pl-c1">*</span><span class="pl-s1">a</span>, <span class="pl-c1">**</span><span class="pl-s1">kw</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/celery/celery/app/task.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">400</span>, <span class="pl-s1">in</span> <span class="pl-s1">__call__</span>
    <span class="pl-k">return</span> <span class="pl-s1">self</span>.<span class="pl-en">run</span>(<span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/celery/tasks.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">21</span>, <span class="pl-s1">in</span> <span class="pl-s1">add</span>
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/tenacity/__init__.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">292</span>, <span class="pl-s1">in</span> <span class="pl-s1">wrapped_f</span>
    <span class="pl-k">return</span> <span class="pl-s1">self</span>.<span class="pl-en">call</span>(<span class="pl-s1">f</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kw</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/tenacity/__init__.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">358</span>, <span class="pl-s1">in</span> <span class="pl-s1">call</span>
    <span class="pl-s1">do</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">iter</span>(<span class="pl-s1">retry_state</span><span class="pl-c1">=</span><span class="pl-s1">retry_state</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/tenacity/__init__.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">332</span>, <span class="pl-s1">in</span> <span class="pl-s1">iter</span>
    <span class="pl-s1">six</span>.<span class="pl-en">raise_from</span>(<span class="pl-s1">retry_exc</span>, <span class="pl-s1">fut</span>.<span class="pl-en">exception</span>())
  <span class="pl-v">File</span> <span class="pl-s">"&lt;string&gt;"</span>, <span class="pl-s1">line</span> <span class="pl-c1">3</span>, <span class="pl-s1">in</span> <span class="pl-s1">raise_from</span>
<span class="pl-s1">tenacity</span>.<span class="pl-v">RetryError</span>: <span class="pl-v">RetryError</span>[<span class="pl-c1">&lt;</span><span class="pl-v">Future</span> <span class="pl-s1">at</span> <span class="pl-c1">0x7fe83b4c4240</span> <span class="pl-s1">state</span><span class="pl-c1">=</span><span class="pl-s1">finished</span> <span class="pl-s1">raised</span> <span class="pl-v">ValueError</span><span class="pl-c1">&gt;</span>]</pre></div>
<h1 dir="auto">Actual Behavior</h1>

<p dir="auto">Instead, it fails to serialize the exception</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[2019-07-01 17:47:12,837: WARNING/ForkPoolWorker-1] attempt foo
[2019-07-01 17:47:13,846: WARNING/ForkPoolWorker-1] attempt foo
[2019-07-01 17:47:13,866: ERROR/ForkPoolWorker-1] Task tasks.add[f303fe29-11fe-4da6-aed4-97648b0c27d1] raised unexpected: RetryError('&lt;Future at 0x7fdf2212b710 state=finished raised ValueError&gt;',)
Traceback (most recent call last):
  File &quot;/home/developer/celery/celery/app/trace.py&quot;, line 385, in trace_task
    R = retval = fun(*args, **kwargs)
  File &quot;/home/developer/celery/celery/app/trace.py&quot;, line 650, in __protected_call__
    return self.run(*args, **kwargs)
  File &quot;/home/developer/celery/tasks.py&quot;, line 21, in add
    foo(x)
  File &quot;/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/tenacity/__init__.py&quot;, line 292, in wrapped_f
    return self.call(f, *args, **kw)
  File &quot;/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/tenacity/__init__.py&quot;, line 358, in call
    do = self.iter(retry_state=retry_state)
  File &quot;/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/tenacity/__init__.py&quot;, line 332, in iter
    six.raise_from(retry_exc, fut.exception())
  File &quot;&lt;string&gt;&quot;, line 3, in raise_from
tenacity.RetryError: &lt;Future at 0x7fdf2212b710 state=finished raised ValueError&gt;
[2019-07-01 17:47:13,880: ERROR/MainProcess] Task handler raised error: &lt;MaybeEncodingError: Error sending result: '&quot;(1, &lt;ExceptionInfo: RetryError('&lt;Future at 0x7fdf2212b710 state=finished raised ValueError&gt;',)&gt;, None)&quot;'. Reason: ''PicklingError(&quot;Can\'t pickle &lt;class \'tenacity.RetryError\'&gt;: it\'s not the same object as tenacity.RetryError&quot;,)''.&gt;
Traceback (most recent call last):
  File &quot;/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/billiard/pool.py&quot;, line 362, in workloop
    put((READY, (job, i, result, inqW_fd)))
  File &quot;/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/billiard/queues.py&quot;, line 366, in put
    self.send_payload(ForkingPickler.dumps(obj))
  File &quot;/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/billiard/reduction.py&quot;, line 56, in dumps
    cls(buf, protocol).dump(obj)
billiard.pool.MaybeEncodingError: Error sending result: '&quot;(1, &lt;ExceptionInfo: RetryError('&lt;Future at 0x7fdf2212b710 state=finished raised ValueError&gt;',)&gt;, None)&quot;'. Reason: ''PicklingError(&quot;Can\'t pickle &lt;class \'tenacity.RetryError\'&gt;: it\'s not the same object as tenacity.RetryError&quot;,)''."><pre class="notranslate">[<span class="pl-c1">2019</span><span class="pl-c1">-</span><span class="pl-c1">07</span><span class="pl-c1">-</span><span class="pl-c1">01</span> <span class="pl-c1">17</span>:<span class="pl-c1">47</span>:<span class="pl-c1">12</span>,<span class="pl-c1">837</span>: <span class="pl-v">WARNING</span><span class="pl-c1">/</span><span class="pl-v">ForkPoolWorker</span><span class="pl-c1">-</span><span class="pl-c1">1</span>] <span class="pl-s1">attempt</span> <span class="pl-s1">foo</span>
[<span class="pl-c1">2019</span><span class="pl-c1">-</span><span class="pl-c1">07</span><span class="pl-c1">-</span><span class="pl-c1">01</span> <span class="pl-c1">17</span>:<span class="pl-c1">47</span>:<span class="pl-c1">13</span>,<span class="pl-c1">846</span>: <span class="pl-v">WARNING</span><span class="pl-c1">/</span><span class="pl-v">ForkPoolWorker</span><span class="pl-c1">-</span><span class="pl-c1">1</span>] <span class="pl-s1">attempt</span> <span class="pl-s1">foo</span>
[<span class="pl-c1">2019</span><span class="pl-c1">-</span><span class="pl-c1">07</span><span class="pl-c1">-</span><span class="pl-c1">01</span> <span class="pl-c1">17</span>:<span class="pl-c1">47</span>:<span class="pl-c1">13</span>,<span class="pl-c1">866</span>: <span class="pl-v">ERROR</span><span class="pl-c1">/</span><span class="pl-v">ForkPoolWorker</span><span class="pl-c1">-</span><span class="pl-c1">1</span>] <span class="pl-v">Task</span> <span class="pl-s1">tasks</span>.<span class="pl-s1">add</span>[<span class="pl-s1">f303fe29</span><span class="pl-c1">-</span><span class="pl-c1">11</span><span class="pl-s1">fe</span><span class="pl-c1">-</span><span class="pl-c1">4</span><span class="pl-s1">da6</span><span class="pl-c1">-</span><span class="pl-s1">aed4</span><span class="pl-c1">-</span><span class="pl-c1">97648</span><span class="pl-s1">b0c27d1</span>] <span class="pl-s1">raised</span> <span class="pl-s1">unexpected</span>: <span class="pl-v">RetryError</span>(<span class="pl-s">'&lt;Future at 0x7fdf2212b710 state=finished raised ValueError&gt;'</span>,)
<span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/celery/celery/app/trace.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">385</span>, <span class="pl-s1">in</span> <span class="pl-s1">trace_task</span>
    <span class="pl-v">R</span> <span class="pl-c1">=</span> <span class="pl-s1">retval</span> <span class="pl-c1">=</span> <span class="pl-en">fun</span>(<span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/celery/celery/app/trace.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">650</span>, <span class="pl-s1">in</span> <span class="pl-s1">__protected_call__</span>
    <span class="pl-k">return</span> <span class="pl-s1">self</span>.<span class="pl-en">run</span>(<span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/celery/tasks.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">21</span>, <span class="pl-s1">in</span> <span class="pl-s1">add</span>
    <span class="pl-en">foo</span>(<span class="pl-s1">x</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/tenacity/__init__.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">292</span>, <span class="pl-s1">in</span> <span class="pl-s1">wrapped_f</span>
    <span class="pl-k">return</span> <span class="pl-s1">self</span>.<span class="pl-en">call</span>(<span class="pl-s1">f</span>, <span class="pl-c1">*</span><span class="pl-s1">args</span>, <span class="pl-c1">**</span><span class="pl-s1">kw</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/tenacity/__init__.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">358</span>, <span class="pl-s1">in</span> <span class="pl-s1">call</span>
    <span class="pl-s1">do</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">iter</span>(<span class="pl-s1">retry_state</span><span class="pl-c1">=</span><span class="pl-s1">retry_state</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/tenacity/__init__.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">332</span>, <span class="pl-s1">in</span> <span class="pl-s1">iter</span>
    <span class="pl-s1">six</span>.<span class="pl-en">raise_from</span>(<span class="pl-s1">retry_exc</span>, <span class="pl-s1">fut</span>.<span class="pl-en">exception</span>())
  <span class="pl-v">File</span> <span class="pl-s">"&lt;string&gt;"</span>, <span class="pl-s1">line</span> <span class="pl-c1">3</span>, <span class="pl-s1">in</span> <span class="pl-s1">raise_from</span>
<span class="pl-s1">tenacity</span>.<span class="pl-v">RetryError</span>: <span class="pl-c1">&lt;</span><span class="pl-v">Future</span> <span class="pl-s1">at</span> <span class="pl-c1">0x7fdf2212b710</span> <span class="pl-s1">state</span><span class="pl-c1">=</span><span class="pl-s1">finished</span> <span class="pl-s1">raised</span> <span class="pl-v">ValueError</span><span class="pl-c1">&gt;</span>
[<span class="pl-c1">2019</span><span class="pl-c1">-</span><span class="pl-c1">07</span><span class="pl-c1">-</span><span class="pl-c1">01</span> <span class="pl-c1">17</span>:<span class="pl-c1">47</span>:<span class="pl-c1">13</span>,<span class="pl-c1">880</span>: <span class="pl-v">ERROR</span><span class="pl-c1">/</span><span class="pl-v">MainProcess</span>] <span class="pl-v">Task</span> <span class="pl-s1">handler</span> <span class="pl-s1">raised</span> <span class="pl-s1">error</span>: <span class="pl-c1">&lt;</span><span class="pl-v">MaybeEncodingError</span>: <span class="pl-v">Error</span> <span class="pl-s1">sending</span> <span class="pl-s1">result</span>: <span class="pl-s">'"(1, &lt;ExceptionInfo: RetryError('</span><span class="pl-c1">&lt;</span><span class="pl-v">Future</span> <span class="pl-s1">at</span> <span class="pl-c1">0x7fdf2212b710</span> <span class="pl-s1">state</span><span class="pl-c1">=</span><span class="pl-s1">finished</span> <span class="pl-s1">raised</span> <span class="pl-v">ValueError</span><span class="pl-c1">&gt;</span><span class="pl-s">',)&gt;, None)"'</span>. <span class="pl-v">Reason</span>: <span class="pl-s">''</span><span class="pl-v">PicklingError</span>(<span class="pl-s">"Can<span class="pl-cce">\'</span>t pickle &lt;class <span class="pl-cce">\'</span>tenacity.RetryError<span class="pl-cce">\'</span>&gt;: it<span class="pl-cce">\'</span>s not the same object as tenacity.RetryError"</span>,)<span class="pl-s">''</span>.<span class="pl-c1">&gt;</span>
<span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/billiard/pool.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">362</span>, <span class="pl-s1">in</span> <span class="pl-s1">workloop</span>
    <span class="pl-en">put</span>((<span class="pl-v">READY</span>, (<span class="pl-s1">job</span>, <span class="pl-s1">i</span>, <span class="pl-s1">result</span>, <span class="pl-s1">inqW_fd</span>)))
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/billiard/queues.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">366</span>, <span class="pl-s1">in</span> <span class="pl-s1">put</span>
    <span class="pl-s1">self</span>.<span class="pl-en">send_payload</span>(<span class="pl-v">ForkingPickler</span>.<span class="pl-en">dumps</span>(<span class="pl-s1">obj</span>))
  <span class="pl-v">File</span> <span class="pl-s">"/home/developer/.pyenv/versions/python3.6/lib/python3.6/site-packages/billiard/reduction.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">56</span>, <span class="pl-s1">in</span> <span class="pl-s1">dumps</span>
    <span class="pl-en">cls</span>(<span class="pl-s1">buf</span>, <span class="pl-s1">protocol</span>).<span class="pl-en">dump</span>(<span class="pl-s1">obj</span>)
<span class="pl-s1">billiard</span>.<span class="pl-s1">pool</span>.<span class="pl-v">MaybeEncodingError</span>: <span class="pl-v">Error</span> <span class="pl-s1">sending</span> <span class="pl-s1">result</span>: <span class="pl-s">'"(1, &lt;ExceptionInfo: RetryError('</span><span class="pl-c1">&lt;</span><span class="pl-v">Future</span> <span class="pl-s1">at</span> <span class="pl-c1">0x7fdf2212b710</span> <span class="pl-s1">state</span><span class="pl-c1">=</span><span class="pl-s1">finished</span> <span class="pl-s1">raised</span> <span class="pl-v">ValueError</span><span class="pl-c1">&gt;</span><span class="pl-s">',)&gt;, None)"'</span>. <span class="pl-v">Reason</span>: <span class="pl-s">''</span><span class="pl-v">PicklingError</span>(<span class="pl-s">"Can<span class="pl-cce">\'</span>t pickle &lt;class <span class="pl-cce">\'</span>tenacity.RetryError<span class="pl-cce">\'</span>&gt;: it<span class="pl-cce">\'</span>s not the same object as tenacity.RetryError"</span>,)<span class="pl-s">''</span>.</pre></div>