title: WorkerLostError('Worker exited prematurely: signal 15 (SIGTERM).',)
body: <p>I recently started using celery in a new Django project. Settings: </p>
  
  <pre><code> -------------- celery@123 v3.1.7 (Cipater) 
  ---- **** -----  
  --- * ***  * -- Linux-3.8.11-ec2-x86_64-with-debian-squeeze-sid 
  -- * - **** ---  
  - ** ---------- [config] 
  - ** ---------- .&gt; app:         nextlanding_api:0x1c23250 
  - ** ---------- .&gt; transport:   redis://rediscloud@123123 
  - ** ---------- .&gt; results:     djcelery.backends.database:DatabaseBackend 
  - *** --- * --- .&gt; concurrency: 4 (prefork) 
  -- ******* ----  
  --- ***** ----- [queues] 
   -------------- .&gt; celery           exchange=celery(direct) key=celery 
  
  software -&gt; celery:3.1.7 (Cipater) kombu:3.0.8 py:2.7.4
              billiard:3.3.0.13 redis:2.9.0
  platform -&gt; system:Linux arch:64bit, ELF imp:CPython
  loader   -&gt; celery.loaders.app.AppLoader
  settings -&gt; transport:redis results:djcelery.backends.database:DatabaseBackend 
  </code></pre>
  
  <p>I'm investigating an issue where tasks with eta 24+ hours are <em>disappearing</em> (I've ensured the <a href="http://www.google.com/url?q=http%3A%2F%2Fdocs.celeryproject.org%2Fen%2Flatest%2Fgetting-started%2Fbrokers%2Fredis.html%23visibility-timeout&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNEzmB6ksRrOi4OwE5pyNfO9SH3O6w" rel="noreferrer">visibility_timeout</a> is > 24 hours). When I warmly shut down the worker, the log statements show several messages being acknowledged. Example:
  <code>Restoring 26 unacknowledged message(s).</code></p>
  
  <p>However, I expected ~50 or so unacknowledged messages to be restored. Looking into my logs a little closer, I see:</p>
  
  <pre><code>[ERROR] celery.worker.job: Task myproj_task[xxx] raised unexpected: WorkerLostError('Worker exited prematurely: signal 15 (SIGTERM).',)
  ...
  WorkerLostError: Worker exited prematurely: signal 15 (SIGTERM). 
  Restoring 26 unacknowledged message(s). 
  Process exited with status 0 
  </code></pre>
  
  <p>I've seen others report OOM kills their process. I am on Heroku and see no <a href="https://www.google.com/url?q=https%3A%2F%2Fdevcenter.heroku.com%2Farticles%2Ferror-codes%23r14-memory-quota-exceeded&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNFeBZ2Q6kn_OX9YtudNjf_c4oUeVA" rel="noreferrer">R14</a> codes.</p>
  
  <p>One last bit of context, I'm spawning new processes from within my tasks.</p>
  
  <p>My question is: is the WorkerLostError something I should worry about? The status code is 15 (SIGTERM) which seems to be OK. If this error is not normal, could it be a possible cause to losing ETA tasks?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>At first I thought items were <em>disappearing</em> but after putting in some verbose logs, I can see the tasks were issued but never persisted in redis:</p>
  
  <p><code>myproj_email_task was sent. task_id: b6ce2b97-d5b8-4850-9e43-9185426cd9f6</code></p>
  
  <p>However, looking over the tasks in redis, the task <code>b6ce2b97-d5b8-4850-9e43-9185426cd9f6</code> does not exist.</p>
  
  <p>So it would appear the tasks are not disappearing, but either not being sent at all or not being put into the <code>unacked</code> redis key.</p>