title: No child processes error ... again
body: <p>I have a process running (call it main proc if you will) doing something. At some point it forks a process say proc1 that does something else. At some other point proc1 decides it needs a child process to do some chores, let's call it proc2. </p>
  
  <p>proc2 does it's business or runs in an infinite loop at which point proc1 sends a sigterm signal to its' child proc2. Anyway, either way, proc2 finishes cleanly. While proc2 is doing the necessary stuff proc1 is waiting for proc2 to finish. When waitpid() reports proc2 as finished proc1 sends itself sigterm and exits. At that moment the main process was doing a check with waitpid(pid, WNOHANG) in a loop. When proc1 finishes my waitpid from main process throws an error: <strong>*Error in atexit._run_exitfuncs: OSError: [Errno 10] No child processes*</strong> and <strong><em>Error in sys.exitfunc:OSError: [Errno 10] No child processes</em></strong>.</p>
  
  <p>From what I learned reading around similar questions there is a problem in handling the SIGCHLD signal. If this is the problem than i am unclear as how to solve it.
  At the moment I solved this by putting the waitpid() in the main process in a try except block. Are there other ways? any better ways?</p>
  
  <p>If it helps I can add an example that I've been fiddling with replicating the errors.
  Thank you in advance.</p>