title: Python Multiprocessing leading to many zombie processes
body: <p>I have been implementing python's multiprocessing library using a pool of workers. I implemented the following code </p>
  
  <pre><code>import main1
  t1 = time.time()
  p = Pool(cores) 
  result = p.map(main1, client_list[client])
  if result == []:
      return []
  p.close()
  p.join()
  print "Time taken in performing request:: ", time.time()-t1
  return shorted(result)
  </code></pre>
  
  <p>However, after running the process for a while, I get lot of running background processes of my app. Here is a snapshot after doing ps aux for my app</p>
  
  <p><img src="https://i.stack.imgur.com/naoU4.png" alt="Snapshot showing all the zombie processes"></p>
  
  <p>Now, I have read a lot of similar questions on stackoverflow like <a href="https://stackoverflow.com/questions/19322129/how-to-kill-zombie-processes-created-by-multiprocessing-module">how to kill zombie processes created by multiprocessing module?</a> which calls for using .join() which I have already implemented and I learned how to kill all these processes from here <a href="https://stackoverflow.com/questions/18477320/python-multiprocessing-kill-processes?lq=1">Python Multiprocessing Kill Processes</a>. But I want to know what possibly could go wrong with my code.
  I won't able to share all of my code in the main1 function but I have put the entire code block in try catch block to avoid cases where an error in the main code could lead to zombie processes. </p>
  
  <pre><code>def main1((param1, param2, param3)):
      try:
         resout.append(some_data) //resout in case of no error
      except:
          print traceback.format_exc()
          resout = []  //sending empty resout in case of error
      return resout
  </code></pre>
  
  <p>I'm still very new to the concept of parallel programming and debugging issues with it is turning out to be tricky.Any help will be greatly appreciated.</p>