[Rd] issue with parallel package

Josef Leydold josef.leydold at wu.ac.at
Wed May 21 19:17:29 CEST 2014

Dear maintainers of the parallel package,

I ran into an issue with the parallel package in R-3.1.0.

The following code prints the message "NULL!" quite a lot.

for (n in 1:1000) {
       p <- mcparallel(sqrt(n))
       res <- mccollect(p, wait=FALSE, timeout=1000)
       if (is.null(res)) cat(n,"  NULL!\n")

It does not happen in R-3.0.3.
(To be exact, I have checked out R-devel revision r65130
 for my current tests.)

I found that this behavior is introduced in revision r65143.

When I insert
in the loop then this behavior disappears in R-3.1.0.

There is also another difference between R-3.1.0 and R-3.0.3:
When the line
is replaced by
   mccollect(p, wait=FALSE, timeout=1000)
then in R-3.1.0 some child processes are not terminated and some
pipes remain open. This does not happen in R-3.0.3.

If the line
is omitted at all then "NULL!" is never printed but
R aborts after 510 iterations of the loop with the message
"Error in mcfork(detached) : unable to create a pipe".
Then none of the child processes is terminated and
number of possible open pipes is exhausted.

Is this behavior intended or a bug?

> version
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
major          3                           
minor          1.0                         
year           2014                        
month          04                          
day            10                          
svn rev        65387                       
language       R                           
version.string R version 3.1.0 (2014-04-10)
nickname       Spring Dance                

best whishes



Josef Leydold

Institute for Statistics and Mathematics
WU (Vienna University of Economics and Business)

Welthandelsplatz 1, Building D4, 1020 Vienna, Austria

Phone +43 1 31336 4695  FAX +43 1 31336 904695  email josef.leydold at wu.ac.at

Alles Unglueck kam daher, dass die Denkenden nicht mehr handeln konnten,
und die Handelnden keine Zeit mehr fanden zu denken.       (Marlen Haushofer)

More information about the R-devel mailing list