[Rd] DOCUMENTATION(?): parallel::mcparallel() gives various types of "Error in unserialize(r) : ..." errors if value is of type raw

Henrik Bengtsson henrik@bengt@@on @ending from gm@il@com
Thu Jun 21 05:05:52 CEST 2018


I stumbled upon the following:

f <- parallel::mcparallel(raw(0L))
parallel::mccollect(f)
# $`77083`
# NULL

but

f <- parallel::mcparallel(raw(1L))
parallel::mccollect(f)
# Error in unserialize(r) : read error
traceback()
# 2: unserialize(r)
# 1: parallel::mccollect(f)

(restarting because the above appears to corrupt the R session)

f <- parallel::mcparallel(raw(2L))
parallel::mccollect(f)
# Error in unserialize(r) : unknown input format

I can reproduce this on Linux using R 3.5.0 all the way back to R
3.3.2 (didn't try further) and R development (unstable) (2018-06-19
r74919).

Diving into the code of parallel::mccollect(), it looks that the 'raw'
data type has a special purpose:

                  r <- readChild(pid)
                  if (is.integer(r) || is.null(r))
                    fin[pid == pids] <- TRUE
                  if (is.raw(r))
                    res[which(pid == pids)] <- list(unserialize(r))

However, I don't see this behavior document in ?parallel::mcparallel.
The closest I get is that under the 'Value' section it says:

   "mccollect returns any results that are available in a list. [...]"

Not sure if that should be interpreted as only values that are of type
'list' should be used.  OTH, the example use values of type double.

/Henrik



More information about the R-devel mailing list