title: Python Multiprocessing Script Freezes Seemingly Without Error
body: <p>I am trying to use the <code>multiprocessing</code> package to call a function (let's call it <code>myfunc</code>) in parallel, specifically using <code>pool.map</code> i.e. <code>pool.map(myfunc, myarglist)</code>. When I simply loop over <code>myarglist</code> without using <code>multiprocessing</code> there are no errors, which should be the case because all operations in <code>myfunc</code> are called within a <code>try</code> block. However, when I call the function using <code>pool.map</code> the script invariably stops running, i.e. it stop printing a "myfunc done!" statement within my function and the processes stop using the CPUs, but it never returns <code>resultlist</code>. I am running python 2.7 from the terminal in ubuntu 12.04. What could cause this to occur and how should I fix/troubleshoot the problem?</p>
  
  <pre><code>cpu_count = int(multiprocessing.cpu_count())
  pool = Pool(processes = cpu_count)
  resultlist = pool.map(myfunc, myarglist)
  pool.close()
  </code></pre>
  
  <p><strong>Update</strong>
  One issue when using multiprocessing can be the size of the object, if you think that may be a problem see this <a href="https://stackoverflow.com/a/11855207/2327821">answer</a>. As the answer notes "If this [solution] doesn't work, maybe the stuff you're returning from your functions is not pickleable, and therefore unable to make it through the Queues properly." Multiprocessing passes objects between processes by pickling them. It turns out that one or two of my objects had soup from <code>BeautifulSoup</code> <a href="https://stackoverflow.com/questions/24563148/beautifulsoup-object-will-not-pickle-causes-interpreter-to-silently-crash">that would not pickle</a>. </p>