title: Python multiprocessing does not process all items in a list
body: <p>I have the following program that processes files (about 3400 depending on the time of the day). However, it seems to leave out a few, i.e., even though I feed it ~3400 files, it'll only process ~3100, for instance. Here's the code:</p>
  
  <pre><code>import multiprocessing
  from multiprocessing import Pool
  
  def split_list(L, n):
      return [L[i::n] for i in xrange(n)]
  
  def coreFunc(myarg):
  
      listlen = len(myarg)
      print "listlen = ", listlen
  
      for listiter in range(listlen):
          input1 = (myarg[listiter]).rstrip('\n')
          print "input1 = ", input1
  
      return 1
  
  if __name__=="__main__":
  
      fptr = open("myfilelist")
      array = fptr.readlines()
  
      numC = multiprocessing.cpu_count()
      lists = split_list(array, numC)
      p = Pool(numC)
      p.map(coreFunc, lists)
  
      p.close()
      p.join()
  </code></pre>
  
  <p>The "myfilelist" is a text file that contains the filenames of those ~3400 files like this:</p>
  
  <pre><code>    /home/user/file1
      /home/user/file2
      /home/user/file3
      ….
  </code></pre>
  
  <p>It leaves out about 300 files each time I run the program. The files left out are not always the same. It varies it each run.</p>
  
  <p>Any idea why these files are being left out? I verified that it is nothing to do with the field themselves by using a different set of files, by rearranging the names of the files in the "filelist", etc, but nothing seems to work. There is no error message either.</p>
  
  <p>Thanks.</p>