[R-sig-hpc] Warning "closing unused connection..." with package parallel

Zepu Zhang zepu.zhang at gmail.com
Mon Jan 23 01:33:34 CET 2012

Dear list,

After running the following chunk of code repeatedly in a package


f <- function(nsim, ...)
        cl <- makeCluster(detectCores())
        rng.kind <- RNGkind()
        on.exit(RNGkind(rng.kind[1], rng.kind[2]))
        clusterSetRNGStream(cl, trunc(runif(1) * 10000))

        z <- clusterApply(cl, seq_len(nsim),
                function(dummy, ...)
                   { #some custom function that does simulation
                # additional arguments passed into function
      # other stuff

I got > 50 warnings like

34: closing unused connection 3 (<-localhost.localdomain:10187)
35: closing unused connection 4 (<-localhost.localdomain:10187)
36: closing unused connection 3 (<-localhost.localdomain:10187)
37: closing unused connection 4 (<-localhost.localdomain:10187)
38: closing unused connection 3 (<-localhost.localdomain:10187)

I've tested this on two Linux boxes with detectCores() returning 2 and
4, respectively, getting the same type of warnings. Although 2 and 4
cores seem to be few, I need this parallel capabilities so that it's
beneficial when the code is run on machines with more cores. It will
be run on both Linux and Windows.

The function called by 'clusterApply' calls package 'RandomFields' for
simulations. It is not apparent that 'RandomFields' does parallel
computations (which might interfere with R).

Any idea what caused these warning messages? If they are harmless, I
really want to avoid them b/c they can mask other useful warnings.


Zepu Zhang

More information about the R-sig-hpc mailing list