[Rd] DOCUMENTATION(?): parallel::mcparallel() gives various types of "Error in unserialize(r) : ..." errors if value is of type raw
Tomas Kalibera
tom@@@k@liber@ @ending from gm@il@com
Mon Jun 25 13:59:12 CEST 2018
Thanks for the report, fixed in documentation of mcparallel. Raw vectors
are reserved for internal use and cannot be returned by expressions
passed to mcparallel. But one can indeed wrap a raw vector into a list.
FYI this internal use is not in readChild/mccollect, but in
sendMaster/mcparallel.
Best
Tomas
On 06/21/2018 05:05 AM, Henrik Bengtsson wrote:
> 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
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list