Possible reasons for " Error in checkForRemoteErrors(lapply(cl, recvResult)) : ... object '.doSnowGlobals' not found" Error?
<p>I have been executing a function script repeatedly in R for many years. Within the function definition, I set up a parallel cluster using on my multi-core Windows workstation using: </p>

<pre><code>  # cores0 &lt;- 20 (cores set to 20 outside of function definition)
  cl.spec &lt;- rep("localhost", cores0)
  cl &lt;- makeCluster(cl.spec, type="SOCK", outfile="") 
  registerDoParallel(cl, cores=cores0)
</code></pre>

<p>As of yesterday, my function execution is no longer working, and was getting hung up for hours. (Additionally, using the Resource Monitor, I could see that none of my CPUs were active despite my script specifying 20 cores).  When I went back into the function and tested line, by line, I discovered that the following line is not executing (i.e., is getting hung up when it would usually execute in a few seconds):  </p>

<pre><code>cl.spec &lt;- rep("localhost", cores0)
cl &lt;- makeCluster(cl.spec, type="SOCK", outfile="")
</code></pre>

<p>I tried looking up the problem and found several references to using "PSOCK" type, but could not determine when to use PSOCK versus SOCK.  Nonetheless, I attempted the same script using "PSOCK" instead of "SOCK":</p>

<pre><code>  cl &lt;- makeCluster(cl.spec, type="PSOCK", outfile="") 
  registerDoParallel(cl, cores=cores0)
</code></pre>

<p>With the PSOCK modification, it no longer got hung up and it appeared to execute this as well as the registerDoParallel() call.</p>

<p>However, when I then executed the complete function containing the above two lines and then called the function, as below, I got an error I had never seen:</p>

<pre><code>Error in checkForRemoteErrors(lapply(cl, recvResult)) : 
  20 nodes produced errors; first error: object '.doSnowGlobals' not found 
</code></pre>

<p>I also tried not specifying the type or outfile, but this produced the identical error as using type="PSOCK"</p>

<pre><code>  cl &lt;- makeCluster(cl.spec) 
  registerDoParallel(cl, cores=cores0)
</code></pre>

<p>My questions:
1. Why might the makeCluster() line be getting hung up when it never has before?
cl &lt;- makeCluster(cl.spec, type="SOCK", outfile="") </p>

<ol start="2">
<li>The problem happens whether I have only the parallel and doParallel packages loaded AND if I also have the snow and doSNOW packages loaded.  Are all 4 packages required to execute foreach() commands?</li>
</ol>

<p>Here is the function definition and function call containing the makeCluster() and registerDoParallel() calls, as above:</p>

<pre><code># FUNCTION DEFINITION
FX_RFprocessingSNPruns &lt;- function(path, CurrentRoundSNPlist, colSAMP, Nruns, ntreeIN, coresIN,CurrentRoundGTframeRDA){

   ...do a bunch of steps ...

  #&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;
  # SET UP INTERNAL FUNCTION
  #&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;
  ImpOOBerr&lt;-function(x,y,d) { 

    create function
  }


  #################################################################
  # SET UP THE CLUSTER
  #################################################################
  #Setup clusters via parallel/DoParallel
  cl.spec &lt;- rep("localhost", cores0)
  cl &lt;- makeCluster(cl.spec, type="PSOCK", outfile="") 
  registerDoParallel(cl, cores=cores0)

  #################################################################
  # *** EMPLOY foreach TO CARRY OUT randomForest IN PARALLEL
  #################################################################
  system.time(RFoutput_runs &lt;- foreach(i=1:Nruns0, .combine='cbind', .packages= 'randomForest', .inorder=FALSE, .multicombine=TRUE, .errorhandling="remove") 

              %dopar% {    

                ...do a bunch of steps ...
              ImpOOBerr(x,y,d)
              })

  #################################################################
  # STOP THE CLUSTER
  #################################################################
  stopCluster(cl)

  return(RFoutput_runs)

}


# CALL FUNCTION
path0="C:/USERS/KDA/WORKING/"
system.time(GTtest_5runs &lt;- FX_RFprocessingSNPruns(
  path=path0,
  CurrentRoundSNPlist="SNPlist.rda",
  colSAMP=20, 
  Nruns=5, 
  ntreeIN=150, 
  coresIN=5,
  CurrentRoundGTframeRDA="GT.rda"))


#Error in checkForRemoteErrors(lapply(cl, recvResult)) : 
#  20 nodes produced errors; first error: object '.doSnowGlobals' not found. 
</code></pre>

<p>I found these posts that reference the error, but the solutions are not working for me:
<a href="https://stackoverflow.com/questions/25079527/error-object-dosnowglobals-not-found">error: object &#39;.doSnowGlobals&#39; not found?</a>
<a href="http://grokbase.com/t/r/r-sig-hpc/148880dpsm/error-object-dosnowglobals-not-found" rel="nofollow noreferrer">http://grokbase.com/t/r/r-sig-hpc/148880dpsm/error-object-dosnowglobals-not-found</a></p>

<p>I'm working on Windows 8 machine, 64-bit with 40 cores.</p>

<pre><code>R.Version()
$platform
[1] "x86_64-w64-mingw32"

$arch
[1] "x86_64"

$os
[1] "mingw32"

$system
[1] "x86_64, mingw32"

$status
[1] ""

$major
[1] "3"

$minor
[1] "3.0"

$year
[1] "2016"

$month
[1] "05"

$day
[1] "03"

$`svn rev`
[1] "70573"

$language
[1] "R"

$version.string
[1] "R version 3.3.0 (2016-05-03)"

$nickname
[1] "Supposedly Educational"
</code></pre>

<p>R version 3.3.0 (2016-05-03) -- "Supposedly Educational"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)</p>