[Rd] Segfault in setMask in R 4.1

Paul Murrell p@u| @end|ng |rom @t@t@@uck|@nd@@c@nz
Tue Sep 21 22:41:30 CEST 2021


Hi

dev->setMask() was introduced in R 4.1.0 ...

https://developer.r-project.org/Blog/public/2020/07/15/new-features-in-the-r-graphics-engine/

https://www.stat.auckland.ac.nz/~paul/Reports/GraphicsEngine/definitions/definitions.html

If your application is using its own custom graphics device, it will 
need updating, see ...

https://www.stat.auckland.ac.nz/~paul/Reports/GraphicsEngine/definitions/definitions.html#devices

But it looks like you may just be using the graphics device provided by 
the 'Cairo' package, which has already been updated.   If that is the 
case, your problem may be solved simply be reinstalling the 'Cairo' package.

Paul

p.s. the reason why it only happens for 'ggplot2' plots is that only 
'grid' (which underlies 'ggplot2') attempts to set masks (the 'graphics' 
package does not).

On 9/22/2021 4:52 AM, Mike Lee Williams wrote:
> Thank you! Here is the output of option("devices"), which I think means 
> we're using Cairo:
> 
> $device
> function (width = 1280, height = 960, pointsize = 24, units = "px",
> bg = "white", dpi = 160, ...)
> {
> devSym <- basename(tempfile(pattern = "SensePlot", tmpdir = ""))
> newDev <- Cairo(width = width, height = height, pointsize = pointsize,
> bg = bg, units = units, dpi = dpi, type = "raster", ...)
> attr(newDev, "units") <- units
> attr(newDev, "dpi") <- dpi
> assign(devSym, newDev, SenseDevices)
> invisible(newDev)
> }
> <bytecode: 0x55b08ba031c0>
> <environment: namespace:Cairo>
> 
> "Sense" is the internal name of our application. I'm not sure what 
> "devSym" and "newDev" are, but If there are no known issues with Cairo 
> itself then our own code is presumably part of the problem.
> 
> I would like to confirm that by failing to reproduce the bug in 
> "vanilla" R 4.1 with a Cairo device. If anyone has any tips for how to 
> do that (on Linux) or any other comments I would be very grateful.
> 
> If our code is the problem then I'm still confused why a regular plot() 
> works, but a ggplot2 qplot() segfaults. Maybe this is a clue!
> 
> I will post again if I figure anything out!
> 
> Mike
> 
> On Tue, Sep 21, 2021, at 3:37 AM, GILLIBERT, Andre wrote:
>  > Hello,
>  >
>  > Which graphic device (backend) do you use?
>  > The setMask() function calls the internal setMask function associated
>  > to the graphic device.
>  > If the Web application uses one of the standard graphic backend, the
>  > bug may come from the R core. If it uses a custom graphic backend, the
>  > bug may be in the backend.
>  >
>  > --
>  > Sincerely
>  > André GILLIBERT
>  >
>  > ATTENTION: Cet e-mail provient d’une adresse mail extérieure au CHU de
>  > Rouen. Ne cliquez pas sur les liens ou n'ouvrez pas les pièces jointes
>  > à moins de connaître l'expéditeur et de savoir que le contenu est sûr.
>  > En cas de doute, transférer le mail à « DSI, Sécurité » pour analyse.
>  > Merci de votre vigilance
>  >
>  >
>  > I have inherited a build of R. We compile R from source and then use 
> a custom
>  > web application to allow users to enter R statements and render the 
> output (it's
>  > kind of like RStudio although the UX is quite different).
>  >
>  > Things were going fine until I tried to upgrade to R 4.1.x. The build 
> succeeds,
>  > but I get the following segfault when I make qplot (ggplot2) calls:
>  >
>  > *** caught segfault ***
>  > address (nil), cause 'memory not mapped'
>  >
>  > Traceback:
>  > 1: .setMask(NULL, NULL)
>  > 2: resolveMask.NULL(NULL)
>  > 3: (function (path) { UseMethod("resolveMask")})(NULL)
>  > 4: grid.newpage()
>  > 5: print.ggplot(x)
>  > 6: (function (x, ...) UseMethod("print"))(x)
>  >
>  > I am not an R developer, so I don't really know how to read this. I 
> am wondering
>  > if this is a known issue or if anyone has any suggestions. Here's 
> some things
>  > I've tested:
>  >
>  > - I get the same segfault in R 4.1.0 and R 4.1.1. I do not get this 
> error in R
>  > 4.0.4 or R 4.0.5.
>  >
>  > - The problem appears to be specific to the (graphics?) features of R 
> that
>  > ggplot2 uses. I do not get a segfault if I do a generic `plot(c(1,2,3))`.
>  >
>  > - I have tried versions of ggplot2 3.3.3 and 3.3.5.
>  >
>  > - The traceback points to files that were introduced in this commit
>  >
>  > 
> https://github.com/wch/r-source/commit/16755bcddffe0cb4238d8a4979387d92b93a8324#diff-5c63f74229830cdde7886a50bf06dafcdf1d5b3d42cfa06b26814876e58c5ab0 
> <https://github.com/wch/r-source/commit/16755bcddffe0cb4238d8a4979387d92b93a8324#diff-5c63f74229830cdde7886a50bf06dafcdf1d5b3d42cfa06b26814876e58c5ab0>
>  >
>  > I am not an R user or R developer so I'm a bit stuck here. I would be 
> happy to
>  > give the output of any commands. If anyone has any suggestions then 
> please let
>  > me know!
>  >
>  > Thanks!
>  > Mike Lee Williams
>  >
>  > ______________________________________________
>  > R-devel using r-project.org mailing list
>  > https://stat.ethz.ch/mailman/listinfo/r-devel 
> <https://stat.ethz.ch/mailman/listinfo/r-devel>
> 
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel 
> <https://stat.ethz.ch/mailman/listinfo/r-devel>

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul using stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



More information about the R-devel mailing list