title: Processes launched from wsgi are still running after restarting/reloading the server
body: <p>On Ubuntu 12.04 with mod_wsgi for python 3.</p>
  
  <p>I have a WSGI application (actually just a script) that happens to launch an external program with Popen for each user session (it's actually a small GTK program, I'm experimenting with its HTML5 backend).</p>
  
  <p>There is a Javascript loop on the client side which send a "keep alive" signal each few seconds to the WSGI. If the WSGI did not received any signal for a session for a while, then it will kill the relative process (and delete the session).</p>
  
  <p>This works well, except when I restart/reload Apache or when I edit the WSGI script (which AFAIK automatically reload the app).
  If I do such a thing, subprocesses are not killed. They still run (they aren't zombies) and all I can do is to kill them manually (the WSGI lost former sessions so it won't kill any "old" process).</p>
  
  <p>So I would like one of the following:</p>
  
  <ul>
  <li>A way to notice that the server is stopping/restarting/reloading from the WSGI side, so that it can clean-up it's subprocesses while it knows them</li>
  <li>Spawned processes should died with mod_wsgi (currently it seems subprocesses are reattached to Init when mod_wsgi is killed/reloaded)</li>
  </ul>
  
  <p>Here is the VirtualHost I use:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
  
  WSGIDaemonProcess deckard_qh user=deckard group=deckard threads=5
  WSGIScriptAlias / /home/deckard/wsgi/deckard_qh.wsgi
  Alias /ressources /home/deckard/ressources
  
  &lt;Directory /home/deckard/wsgi&gt;
      WSGIProcessGroup deckard_qh
      WSGIApplicationGroup %{GLOBAL}
      Order deny,allow
      Allow from all
  &lt;/Directory&gt;
  
  &lt;Directory /home/deckard/ressources&gt;
      Order deny,allow
      Allow from all
  &lt;/Directory&gt;
  </code></pre>
  
  <p></p>
  
  <p>I tried adding <code>WSGIProcessGroup deckard</code> and <code>WSGIApplicationGroup %{GLOBAL}</code> (as per <a href="https://stackoverflow.com/a/10968481/1003970">this answer</a>), but it did not change anything.
  I also added <code>os.setsid()</code> at the start of my WSGI script, but no result.</p>