title: Handling signal: term (gunicorn, eventlet, Flask, Google App Engine)
body: <p>I am running a Flask app on Google App Engine using Gunicorn's async workers.</p>
  
  <p>Every time requests come in, after the last request is finished responding, I get the following message and my gunicorn workers exit. Then, theres a slight delay when the next batch of requests come in.</p>
  
  <pre><code>2020-05-17 16:57:14 default[20200517t125405]  [2020-05-17 16:57:14 +0000] [7] [INFO] Handling signal: term
  2020-05-17 16:57:14 default[20200517t125405]  [2020-05-17 16:57:14 +0000] [7] [INFO] Handling signal: term
  2020-05-17 16:57:14 default[20200517t125405]  [2020-05-17 16:57:14 +0000] [21] [INFO] Worker exiting (pid: 21)
  2020-05-17 16:57:14 default[20200517t125405]  [2020-05-17 16:57:14 +0000] [20] [INFO] Worker exiting (pid: 20)
  2020-05-17 16:57:14 default[20200517t125405]  [2020-05-17 16:57:14 +0000] [18] [INFO] Worker exiting (pid: 18)
  2020-05-17 16:57:14 default[20200517t125405]  [2020-05-17 16:57:14 +0000] [14] [INFO] Worker exiting (pid: 14)
  2020-05-17 16:57:14 default[20200517t125405]  [2020-05-17 16:57:14 +0000] [19] [INFO] Worker exiting (pid: 19)
  </code></pre>
  
  <p>Here is my <strong>app.yaml</strong></p>
  
  <pre><code>runtime: python37
  entrypoint: gunicorn --worker-class eventlet -c gunicorn.conf.py -b :$PORT main:app preload_app=True
  instance_class: F2
  </code></pre>
  
  <p>Here is my <strong>gunicorn.conf.py</strong> file</p>
  
  <pre><code>import multiprocessing
  
  workers = (multiprocessing.cpu_count()) * 2 + 1
  threads = workers # originally didn't have this, just had the workers var defined, but tried this and it also didn't solve the problem
  </code></pre>
  
  <p>I tried searching SO and some other sources but can't find a workaround for this.</p>