[Rd] Something is wrong with the unserialize function

Jiefei Wang @zwj|08 @end|ng |rom gm@||@com
Thu Oct 29 14:53:52 CET 2020

Hi all,

I am not able to export an ALTREP object when `gctorture` is on in the
worker. The package simplemmap can be used to reproduce the problem. See
the example below
## Create a temporary file
filePath <- tempfile()
con <- file(filePath, "wrb")

cl <- makeCluster(1)
x <- mmap(filePath, "double")
## Turn gctorture on
clusterEvalQ(cl, gctorture())
clusterExport(cl, "x")
## x is an 0-length vector on the worker
clusterEvalQ(cl, x)

you can find more info on the problem if you manually build a connection
between two R processes and export the ALTREP object. See output below
> con <- socketConnection(port = 1234,server = FALSE)
> gctorture()
> x <- unserialize(con)
Warning message:
In unserialize(con) :
  cannot unserialize ALTVEC object of class 'mmap_real' from package
'simplemmap'; returning length zero vector
It seems like  simplemmap did not get loaded correctly on the worker. If
you run `library( simplemmap)` before unserializing the ALTREP, there will
be no problem. But I suppose we should be able to unserialize objects
without preloading the library?

This issue can be reproduced on Ubuntu with R version 4.0.2 (2020-06-22)
and Windows with R Under development (unstable) (2020-09-03 r79126).

Here is the link to simplemmap:


	[[alternative HTML version deleted]]

More information about the R-devel mailing list