<p dir="auto">Hey Guys, I just noticed an upgrade to 4.2.0 from 4.1.1 causes breaking changes. Any ideas where this was intoduced?</p>
<p dir="auto">System:<br>
OSX 10.13.5<br>
Anaconda Python 3.7</p>
<h2 dir="auto">Steps to reproduce</h2>
<p dir="auto">Install:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ pip install Celery=4.2.0"><pre class="notranslate"><code class="notranslate">$ pip install Celery=4.2.0
</code></pre></div>
<p dir="auto">Code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="celery_amqp_url=os.getenv(&quot;CELERY_AMQP_URL&quot;)

app = Celery('magic_worker',broker=celery_amqp_url)

@task
def parse(uid):
    print('parsing: %s' % uid)"><pre class="notranslate"><code class="notranslate">celery_amqp_url=os.getenv("CELERY_AMQP_URL")

app = Celery('magic_worker',broker=celery_amqp_url)

@task
def parse(uid):
    print('parsing: %s' % uid)
</code></pre></div>
<p dir="auto">Run:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ celery -A magic_worker worker"><pre class="notranslate"><code class="notranslate">$ celery -A magic_worker worker
</code></pre></div>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">Celery task is consumed.</p>
<h2 dir="auto">Actual behavior</h2>
<p dir="auto">Error throw:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[2018-07-16 21:04:52,098: CRITICAL/MainProcess] Unrecoverable error: TypeError(&quot;'NoneType' object is not iterable&quot;,)
Traceback (most recent call last):
  File &quot;python3.5/site-packages/celery/worker/worker.py&quot;, line 205, in start
    self.blueprint.start(self)
  File &quot;python3.5/site-packages/celery/bootsteps.py&quot;, line 119, in start
    step.start(parent)
  File &quot;python3.5/site-packages/celery/bootsteps.py&quot;, line 369, in start
    return self.obj.start()
  File &quot;python3.5/site-packages/celery/worker/consumer/consumer.py&quot;, line 322, in start
    blueprint.start(self)
  File &quot;python3.5/site-packages/celery/bootsteps.py&quot;, line 119, in start
    step.start(parent)
  File &quot;python3.5/site-packages/celery/worker/consumer/consumer.py&quot;, line 598, in start
    c.loop(*c.loop_args())
  File &quot;python3.5/site-packages/celery/worker/loops.py&quot;, line 91, in asynloop
    next(loop)
  File &quot;python3.5/site-packages/kombu/asynchronous/hub.py&quot;, line 354, in create_loop
    cb(*cbargs)
  File &quot;python3.5/site-packages/kombu/transport/base.py&quot;, line 236, in on_readable
    reader(loop)
  File &quot;python3.5/site-packages/kombu/transport/base.py&quot;, line 218, in _read
    drain_events(timeout=0)
  File &quot;python3.5/site-packages/amqp/connection.py&quot;, line 491, in drain_events
    while not self.blocking_read(timeout):
  File &quot;python3.5/site-packages/amqp/connection.py&quot;, line 497, in blocking_read
    return self.on_inbound_frame(frame)
  File &quot;python3.5/site-packages/amqp/method_framing.py&quot;, line 77, in on_frame
    callback(channel, msg.frame_method, msg.frame_args, msg)
  File &quot;python3.5/site-packages/amqp/connection.py&quot;, line 501, in on_inbound_method
    method_sig, payload, content,
  File &quot;python3.5/site-packages/amqp/abstract_channel.py&quot;, line 128, in dispatch_method
    listener(*args)
  File &quot;python3.5/site-packages/amqp/channel.py&quot;, line 1597, in _on_basic_deliver
    fun(msg)
  File &quot;python3.5/site-packages/kombu/messaging.py&quot;, line 624, in _receive_callback
    return on_m(message) if on_m else self.receive(decoded, message)
  File &quot;python3.5/site-packages/celery/worker/consumer/consumer.py&quot;, line 572, in on_task_received
    callbacks,
  File &quot;python3.5/site-packages/celery/worker/strategy.py&quot;, line 200, in task_message_handler
    handle(req)
  File &quot;python3.5/site-packages/celery/worker/worker.py&quot;, line 223, in _process_task_sem
    return self._quick_acquire(self._process_task, req)
  File &quot;python3.5/site-packages/kombu/asynchronous/semaphore.py&quot;, line 62, in acquire
    callback(*partial_args, **partial_kwargs)
  File &quot;python3.5/site-packages/celery/worker/worker.py&quot;, line 228, in _process_task
    req.execute_using_pool(self.pool)
  File &quot;python3.5/site-packages/celery/worker/request.py&quot;, line 520, in execute_using_pool
    time_limit, soft_time_limit = self.time_limits
TypeError: 'NoneType' object is not iterable"><pre class="notranslate">[2018-07-16 21:04:52,098: CRITICAL/MainProcess] Unrecoverable error: TypeError(<span class="pl-s"><span class="pl-pds">"</span>'NoneType' object is not iterable<span class="pl-pds">"</span></span>,)
Traceback (most recent call last):
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/celery/worker/worker.py<span class="pl-pds">"</span></span>, line 205, <span class="pl-k">in</span> start
    self.blueprint.start(self)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/celery/bootsteps.py<span class="pl-pds">"</span></span>, line 119, <span class="pl-k">in</span> start
    step.start(parent)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/celery/bootsteps.py<span class="pl-pds">"</span></span>, line 369, <span class="pl-k">in</span> start
    <span class="pl-k">return</span> <span class="pl-en">self.obj.start</span>()
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/celery/worker/consumer/consumer.py<span class="pl-pds">"</span></span>, line 322, <span class="pl-k">in</span> start
    blueprint.start(self)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/celery/bootsteps.py<span class="pl-pds">"</span></span>, line 119, <span class="pl-k">in</span> start
    step.start(parent)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/celery/worker/consumer/consumer.py<span class="pl-pds">"</span></span>, line 598, <span class="pl-k">in</span> start
    <span class="pl-en">c.loop(*c.loop_args</span>())
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/celery/worker/loops.py<span class="pl-pds">"</span></span>, line 91, <span class="pl-k">in</span> asynloop
    next(loop)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/kombu/asynchronous/hub.py<span class="pl-pds">"</span></span>, line 354, <span class="pl-k">in</span> create_loop
    cb(<span class="pl-k">*</span>cbargs)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/kombu/transport/base.py<span class="pl-pds">"</span></span>, line 236, <span class="pl-k">in</span> on_readable
    reader(loop)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/kombu/transport/base.py<span class="pl-pds">"</span></span>, line 218, <span class="pl-k">in</span> _read
    drain_events(timeout=0)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/amqp/connection.py<span class="pl-pds">"</span></span>, line 491, <span class="pl-k">in</span> drain_events
    <span class="pl-k">while</span> not self.blocking_read(timeout):
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/amqp/connection.py<span class="pl-pds">"</span></span>, line 497, <span class="pl-k">in</span> blocking_read
    <span class="pl-k">return</span> self.on_inbound_frame(frame)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/amqp/method_framing.py<span class="pl-pds">"</span></span>, line 77, <span class="pl-k">in</span> on_frame
    callback(channel, msg.frame_method, msg.frame_args, msg)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/amqp/connection.py<span class="pl-pds">"</span></span>, line 501, <span class="pl-k">in</span> on_inbound_method
    method_sig, payload, content,
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/amqp/abstract_channel.py<span class="pl-pds">"</span></span>, line 128, <span class="pl-k">in</span> dispatch_method
    listener(<span class="pl-k">*</span>args)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/amqp/channel.py<span class="pl-pds">"</span></span>, line 1597, <span class="pl-k">in</span> _on_basic_deliver
    fun(msg)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/kombu/messaging.py<span class="pl-pds">"</span></span>, line 624, <span class="pl-k">in</span> _receive_callback
    <span class="pl-k">return</span> on_m(message) <span class="pl-k">if</span> on_m <span class="pl-k">else</span> self.receive(decoded, message)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/celery/worker/consumer/consumer.py<span class="pl-pds">"</span></span>, line 572, <span class="pl-k">in</span> on_task_received
    callbacks,
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/celery/worker/strategy.py<span class="pl-pds">"</span></span>, line 200, <span class="pl-k">in</span> task_message_handler
    handle(req)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/celery/worker/worker.py<span class="pl-pds">"</span></span>, line 223, <span class="pl-k">in</span> _process_task_sem
    <span class="pl-k">return</span> self._quick_acquire(self._process_task, req)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/kombu/asynchronous/semaphore.py<span class="pl-pds">"</span></span>, line 62, <span class="pl-k">in</span> acquire
    callback(<span class="pl-k">*</span>partial_args, <span class="pl-k">**</span>partial_kwargs)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/celery/worker/worker.py<span class="pl-pds">"</span></span>, line 228, <span class="pl-k">in</span> _process_task
    req.execute_using_pool(self.pool)
  File <span class="pl-s"><span class="pl-pds">"</span>python3.5/site-packages/celery/worker/request.py<span class="pl-pds">"</span></span>, line 520, <span class="pl-k">in</span> execute_using_pool
    time_limit, soft_time_limit = self.time_limits
TypeError: <span class="pl-s"><span class="pl-pds">'</span>NoneType<span class="pl-pds">'</span></span> object is not iterable</pre></div>
<h2 dir="auto">Work Around</h2>
<p dir="auto">Downgrade to celery 4.1.1</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="pip uninstall Celery
pip install Celery=4.1.1"><pre class="notranslate"><code class="notranslate">pip uninstall Celery
pip install Celery=4.1.1
</code></pre></div>
<p dir="auto">I am getting an error in the stack trace below. It looks like this line is referencing the wrong field name: <a href="https://github.com/celery/celery/blob/master/celery/worker/request.py#L520">https://github.com/celery/celery/blob/master/celery/worker/request.py#L520</a>. I don't think time_limits exists for this Request. The only place in celery codebase that I see using <code class="notranslate">create_request_cls</code> is here </p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/celery/celery/blob/47ca2b462f22a8d48ed8d80c2f9bf8b9dc4a4de6/celery/worker/strategy.py#L130">celery/celery/worker/strategy.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 130
      in
      <a data-pjax="true" class="commit-tease-sha" href="/celery/celery/commit/47ca2b462f22a8d48ed8d80c2f9bf8b9dc4a4de6">47ca2b4</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L130" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="130"></td>
          <td id="LC130" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-v">Req</span> <span class="pl-c1">=</span> <span class="pl-en">create_request_cls</span>(<span class="pl-v">Request</span>, <span class="pl-s1">task</span>, <span class="pl-s1">consumer</span>.<span class="pl-s1">pool</span>, <span class="pl-s1">hostname</span>, <span class="pl-s1">eventer</span>) </td>
        </tr>
    </tbody></table>
  </div>
</div>
. It seems to be creating the Request object from task.Request base. According to the docs <a href="http://docs.celeryproject.org/en/latest/userguide/tasks.html#task-request" rel="nofollow">http://docs.celeryproject.org/en/latest/userguide/tasks.html#task-request</a> task.Request has a field <code class="notranslate">timelimit</code>, not <code class="notranslate">time_limits</code>, hence the TypeError.  worker.Request, on the other hand, does have <code class="notranslate">time_limits</code> <a href="http://docs.celeryproject.org/en/latest/reference/celery.worker.request.html" rel="nofollow">http://docs.celeryproject.org/en/latest/reference/celery.worker.request.html</a>.<p></p>
<p dir="auto">The workaround I did to get my code working is basically to check if the variable is None here <a href="https://github.com/celery/celery/blob/master/celery/worker/request.py#L520">https://github.com/celery/celery/blob/master/celery/worker/request.py#L520</a> :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="if not self.time_limits:
    time_limit = default_time_limit 
    soft_time_limit = default_soft_time_limit
else:
    time_limit, soft_time_limit = self.time_limits"><pre class="notranslate"><code class="notranslate">if not self.time_limits:
    time_limit = default_time_limit 
    soft_time_limit = default_soft_time_limit
else:
    time_limit, soft_time_limit = self.time_limits
</code></pre></div>
<p dir="auto">I am not sure if I did something stupid and don't understand how the code is structured. Please point me at why it's not an error, if it is by design.</p>
<p dir="auto">Stack trace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[2018-07-16 06:09:46,229: CRITICAL/MainProcess] Unrecoverable error: TypeError(&quot;'NoneType' object is not iterable&quot;,)
Traceback (most recent call last):
  File &quot;/usr/lib/python2.7/site-packages/celery/worker/worker.py&quot;, line 205, in start
    self.blueprint.start(self)
  File &quot;/usr/lib/python2.7/site-packages/celery/bootsteps.py&quot;, line 119, in start
    step.start(parent)
  File &quot;/usr/lib/python2.7/site-packages/celery/bootsteps.py&quot;, line 369, in start
    return self.obj.start()
  File &quot;/usr/lib/python2.7/site-packages/celery/worker/consumer/consumer.py&quot;, line 322, in start
    blueprint.start(self)
  File &quot;/usr/lib/python2.7/site-packages/celery/bootsteps.py&quot;, line 119, in start
    step.start(parent)
  File &quot;/usr/lib/python2.7/site-packages/celery/worker/consumer/consumer.py&quot;, line 598, in start
    c.loop(*c.loop_args())
  File &quot;/usr/lib/python2.7/site-packages/celery/worker/loops.py&quot;, line 118, in synloop
    qos.update()
  File &quot;/usr/lib/python2.7/site-packages/kombu/common.py&quot;, line 417, in update
    return self.set(self.value)
  File &quot;/usr/lib/python2.7/site-packages/kombu/common.py&quot;, line 410, in set
    self.callback(prefetch_count=new_value)
  File &quot;/usr/lib/python2.7/site-packages/celery/worker/consumer/tasks.py&quot;, line 47, in set_prefetch_count
    apply_global=qos_global,
  File &quot;/usr/lib/python2.7/site-packages/kombu/messaging.py&quot;, line 558, in qos
    apply_global)
  File &quot;/usr/lib/python2.7/site-packages/amqp/channel.py&quot;, line 1812, in basic_qos
    wait=spec.Basic.QosOk,
  File &quot;/usr/lib/python2.7/site-packages/amqp/abstract_channel.py&quot;, line 59, in send_method
    return self.wait(wait, returns_tuple=returns_tuple)
  File &quot;/usr/lib/python2.7/site-packages/amqp/abstract_channel.py&quot;, line 79, in wait
    self.connection.drain_events(timeout=timeout)
  File &quot;/usr/lib/python2.7/site-packages/amqp/connection.py&quot;, line 491, in drain_events
    while not self.blocking_read(timeout):
  File &quot;/usr/lib/python2.7/site-packages/amqp/connection.py&quot;, line 497, in blocking_read
    return self.on_inbound_frame(frame)
  File &quot;/usr/lib/python2.7/site-packages/amqp/method_framing.py&quot;, line 77, in on_frame
    callback(channel, msg.frame_method, msg.frame_args, msg)
  File &quot;/usr/lib/python2.7/site-packages/amqp/connection.py&quot;, line 501, in on_inbound_method
    method_sig, payload, content,
  File &quot;/usr/lib/python2.7/site-packages/amqp/abstract_channel.py&quot;, line 128, in dispatch_method
    listener(*args)
  File &quot;/usr/lib/python2.7/site-packages/amqp/channel.py&quot;, line 1597, in _on_basic_deliver
    fun(msg)
  File &quot;/usr/lib/python2.7/site-packages/kombu/messaging.py&quot;, line 624, in _receive_callback
    return on_m(message) if on_m else self.receive(decoded, message)
  File &quot;/usr/lib/python2.7/site-packages/celery/worker/consumer/consumer.py&quot;, line 572, in on_task_received
    callbacks,
  File &quot;/usr/lib/python2.7/site-packages/celery/worker/strategy.py&quot;, line 200, in task_message_handler
    handle(req)
  File &quot;/usr/lib/python2.7/site-packages/celery/worker/worker.py&quot;, line 228, in _process_task
    req.execute_using_pool(self.pool)
  File &quot;/usr/lib/python2.7/site-packages/celery/worker/request.py&quot;, line 520, in execute_using_pool
    time_limit, soft_time_limit = self.time_limits
TypeError: 'NoneType' object is not iterable"><pre class="notranslate"><code class="notranslate">[2018-07-16 06:09:46,229: CRITICAL/MainProcess] Unrecoverable error: TypeError("'NoneType' object is not iterable",)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/celery/worker/worker.py", line 205, in start
    self.blueprint.start(self)
  File "/usr/lib/python2.7/site-packages/celery/bootsteps.py", line 119, in start
    step.start(parent)
  File "/usr/lib/python2.7/site-packages/celery/bootsteps.py", line 369, in start
    return self.obj.start()
  File "/usr/lib/python2.7/site-packages/celery/worker/consumer/consumer.py", line 322, in start
    blueprint.start(self)
  File "/usr/lib/python2.7/site-packages/celery/bootsteps.py", line 119, in start
    step.start(parent)
  File "/usr/lib/python2.7/site-packages/celery/worker/consumer/consumer.py", line 598, in start
    c.loop(*c.loop_args())
  File "/usr/lib/python2.7/site-packages/celery/worker/loops.py", line 118, in synloop
    qos.update()
  File "/usr/lib/python2.7/site-packages/kombu/common.py", line 417, in update
    return self.set(self.value)
  File "/usr/lib/python2.7/site-packages/kombu/common.py", line 410, in set
    self.callback(prefetch_count=new_value)
  File "/usr/lib/python2.7/site-packages/celery/worker/consumer/tasks.py", line 47, in set_prefetch_count
    apply_global=qos_global,
  File "/usr/lib/python2.7/site-packages/kombu/messaging.py", line 558, in qos
    apply_global)
  File "/usr/lib/python2.7/site-packages/amqp/channel.py", line 1812, in basic_qos
    wait=spec.Basic.QosOk,
  File "/usr/lib/python2.7/site-packages/amqp/abstract_channel.py", line 59, in send_method
    return self.wait(wait, returns_tuple=returns_tuple)
  File "/usr/lib/python2.7/site-packages/amqp/abstract_channel.py", line 79, in wait
    self.connection.drain_events(timeout=timeout)
  File "/usr/lib/python2.7/site-packages/amqp/connection.py", line 491, in drain_events
    while not self.blocking_read(timeout):
  File "/usr/lib/python2.7/site-packages/amqp/connection.py", line 497, in blocking_read
    return self.on_inbound_frame(frame)
  File "/usr/lib/python2.7/site-packages/amqp/method_framing.py", line 77, in on_frame
    callback(channel, msg.frame_method, msg.frame_args, msg)
  File "/usr/lib/python2.7/site-packages/amqp/connection.py", line 501, in on_inbound_method
    method_sig, payload, content,
  File "/usr/lib/python2.7/site-packages/amqp/abstract_channel.py", line 128, in dispatch_method
    listener(*args)
  File "/usr/lib/python2.7/site-packages/amqp/channel.py", line 1597, in _on_basic_deliver
    fun(msg)
  File "/usr/lib/python2.7/site-packages/kombu/messaging.py", line 624, in _receive_callback
    return on_m(message) if on_m else self.receive(decoded, message)
  File "/usr/lib/python2.7/site-packages/celery/worker/consumer/consumer.py", line 572, in on_task_received
    callbacks,
  File "/usr/lib/python2.7/site-packages/celery/worker/strategy.py", line 200, in task_message_handler
    handle(req)
  File "/usr/lib/python2.7/site-packages/celery/worker/worker.py", line 228, in _process_task
    req.execute_using_pool(self.pool)
  File "/usr/lib/python2.7/site-packages/celery/worker/request.py", line 520, in execute_using_pool
    time_limit, soft_time_limit = self.time_limits
TypeError: 'NoneType' object is not iterable
</code></pre></div>
<h2 dir="auto">Checklist</h2>
<p dir="auto">celery v 4.2.0</p>
<h2 dir="auto">Steps to reproduce</h2>
<p dir="auto">It's part of a much larger project, so I don't have a self-contained example yet.</p>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">return a tuple of (None, None)</p>
<h2 dir="auto">Actual behavior</h2>
<p dir="auto">TypeError</p>