ah  i would forgotten about the  disabled by file  part of the middlware  i guess the difference between a  graceful shutdown  and using the middleware is that one is event driven where the other one requires you to pick a  long time  and assume that after that there are no requests being handled  which would work but the code to implement the graceful shutdown could be pretty easy  potentially just a few lines of code so might be worth thinking about  it s probably just a matter of changing these functions in wsgi py def wait on children self while self running try pid  status os wait if os wifexited status  or os wifsignaled status self  remove children pid self  verify and respawn children pid  status except oserror as err if err errno not in  errno eintr  errno echild raise except keyboardinterrupt log info  li  caught keyboard interrupt  exiting break except exception sighupinterrupt self reload continue eventlet greenio shutdown safe self sock self sock close log debug  exited  def run child self def child hup  args shuts down child processes  existing requests are handled  signal signal signal sighup  signal sig ign eventlet wsgi is accepting false self sock close pid os fork if pid signal signal signal sighup  child hup signal signal signal sigterm  signal sig dfl to look like this def wait on children self while self running try pid  status os wait if os wifexited status  or os wifsignaled status self  remove children pid self  verify and respawn children pid  status except oserror as err if err errno not in  errno eintr  errno echild raise except keyboardinterrupt log info  li  caught keyboard interrupt  exiting break except exception sighupinterrupt self reload continue except exception sigstopinterrupt self graceful shutdown continue eventlet greenio shutdown safe self sock self sock close log debug  exited  def run child self def child hup  args shuts down child processes  existing requests are handled  signal signal signal sighup  signal sig ign eventlet wsgi is accepting false self sock close def child stop  args shuts down child processes  existing requests are handled  signal signal signal sigstop  signal sig ign eventlet wsgi is accepting false self sock close pid os fork if pid signal signal signal sighup  child hup signal signal signal sigstop  child stop signal signal signal sigterm  signal sig dfl and add this one line function def graceful shutdown self send signal to child processes to handle current requests then exit os killpg self pgid  signal sigstop i have not tested the above  i think it might be sufficient because the existing code will do the accounting of the number of children and exit when self children hits zero  but it would need testing  you d do  kill  s stop  glance parent process pid  