title: Python Multiprocessing - Why are my processes are not returning/finishing?
body: <p>I'm trying to parallelize one of my long running tasks. For some reason, it just wont finish and is hanging forever.</p>
  
  <pre><code>import multiprocessing as mp
  
  class PartitionedResult(object):
      index = 0
      P = []
      def __init__(self, index, P):
          self.index = index
          self.P = P        
  
  
  def longRunningTask(index, output):
      P = []
      for i in range (0, 1000):        
          print(i)
          P.append(i)
  
      print("I'm done!")
      output.put(PartitionedResult(index, P))
      return
  
  def main():
      output = mp.Queue()
      processes = [mp.Process(target=longRunningTask, args=(x,output,)) for x in range(4)]
      for p in processes:
          p.start()
  
      for p in processes:
          p.join()
  
      results = [output.get() for p in processes]
      print("This never shows up")
  
  
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>It is printing the numbers 0-999 for every of the 4 proccesses and it is even reaching the "I'm done!" line, but it just wont get to the <code>results = [output.get() for p in processes]</code> line</p>
  
  <p>If I reduce the range of the <code>for</code> loop to let's say <code>range(0,50)</code>, it suddenly works.</p>
  
  <p>What's the problem here?</p>
  
  <p>Edit: I'm using Python 3.4 on Windows 10, I tried it on 2 different computers and with the pycache deleted.</p>