title: R crashing when using foreach doParallel and XML
body: <p>I am writing a function that scrapes a huge XML file. Since the nodes are about one million I would like to use the foreach package. Code and relevat comment below</p>
  
  <pre><code>xmlfile=xmlParse(file="./DATI/xmldata.xml") #read the file
  
  #explore
  if(exists("dbfromxml")) rm(dbfromxml)
  
  
  root&lt;-xmlRoot(xmlfile)
  persons&lt;-xmlChildren(root)
  rm(root)
  nrecords&lt;-xmlSize(persons)
  
  #set out the parallel framework
  
  library(foreach)
  library(doParallel)
  cores &lt;- getOption("mc.cores", detectCores())
  cl&lt;-makeCluster(cores,outfile="ciao.txt")
  registerDoParallel(cl)
  dbfromxml&lt;-foreach(i=1:10,.combine=rbind,.packages = "XML") %dopar% {
  personsxml&lt;-persons[[i]]
  processaXMLPersona(personsxml) #this function works properly ouside a do parallel environment
  }
  stopCluster(cl)
  </code></pre>
  
  <p>The problem arise when I set out the doParallel / makeCluster infrastructure loading .packages = "XML" that makes the R cluster crashing. The following errors come out: Error in unserialize(socklist[[n]]) : error reading from connection; Error in serialize(data, node$con) : error writing to connection</p>