title: `mp.pool.ThreadPool` fails when `mp.pool` works normally
body: <p>I'm using the multiprocessing python library to run in parallel feature selection for a machine learning problem. This function accepts as input a pandas dataframe and returns some figures.</p>
  
  <p>When I execute this function using <code>mp.pool.map()</code> everything runs smoothly. However, if I substitute it with <code>mp.pool.ThreadPool.map()</code> it fails with this error: </p>
  
  <p><code>AssertionError: Number of manager items must equal union of block items
   # manager items: 15, # tot_items: 20</code>.</p>
  
  <p>Strangely, I was running the <code>ThreadPool</code> code normally till yesterday. Then, I tried to re-run it and started getting these errors. I need <code>ThreadPool</code> since this is an IO bound job and it was running much faster compared to <code>pool</code>.</p>
  
  <p><strong>EDIT</strong>: 
  The code goes like that (python 2.7):</p>
  
  <pre><code>import multiprocessing as mp
  import pandas as pd (version 0.22.0)
  
  def main_functionality(df, params):
      df = df[params['feature']]
      #Run 5-fold cross-validation
          data_df = pd.DataFrame(....)
          pred_df = pred_df.append(data_df)
      return statistics from pred_df
  
  def a_function(df_init, feature, params_init):
  
      params = dict(params_init)
      df = df_init.copy()
  
      params['feature'] = feature
      try:
          results = main_functionality(df, params)
      except:
          results = (0,0,0)
  
      return results
  
  def b_function(df, features):
      pool = mp.pool.ThreadPool(4)
      params = {...}
      results = pool.map(a_function,(df, feature, params) for f in features))
  
      results_df = pd.DataFrame(results)
      results_df.to_csv(...)
  
  if __name__ == '__main__':
      df = read.csv(...) # A big CSV file (i.e. few GBs)
      features = [i for i in df.columns if i ....]
  
      b_function(df, features)
  </code></pre>