[Rd] Possible ALTREP bug

Jiefei Wang @zwj|08 @end|ng |rom gm@||@com
Fri May 28 15:53:31 CEST 2021


Hi Gabor,

Calling back to an R function from the ALTREP function is not safe.
There has been a heated discussion on why you should not do it and
that the main reason that we do not have any R level ALTREP API. If
you are interested in it you can find it from this issue:
https://github.com/Bioconductor/Contributions/issues/1222

Best,
Jiefei

On Fri, May 28, 2021 at 4:54 PM Gábor Csárdi <csardi.gabor using gmail.com> wrote:
>
> I have found some weird SEXP corruption behavior with ALTREP, which
> could be a bug. (Or I could be doing something wrong.)
>
> I have an integer ALTREP vector that calls back to R from the Elt
> method. When this vector is indexed in a lapply(), its first element
> gets corrupted. Sometimes it's just a type change to logical, but
> sometimes the corruption causes a crash.
>
> I saw this on macOS from R 3.5.3 to 4.2.0. I created a small package
> that demonstrates this: https://github.com/gaborcsardi/redfish
>
> The R callback in this package calls `loadNamespace("Matrix")`, but
> the same crash happens for other packages as well, and sometimes it
> also happens if I don't load any packages at all. (But that example
> was much more complicated, so I went with the package loading.)
>
> It is somewhat random, and sometimes turning off the JIT avoids the
> crash, but not always.
>
> Hopefully I am just doing something wrong in the ALTREP code (see
> https://github.com/gaborcsardi/redfish/blob/main/src/test.c), and it
> is not actually a bug.
>
> Thanks,
> Gabor
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list