I'm all set! My problem seems to have been a mixture of two things: 1. As Paul pointed out I needed to upgrade Cairo to get support for the new GE v13 (setMask, etc.). That support is apparently present in 1.5-12.2 (the current version on CRAN).
2. I was getting Cairo from https://github.com/s-u/Cairo/ rather than CRAN, and github and CRAN seem to have diverged, such that 1.5-13 (on github) doesn't contain the GE v13 change despite being a higher version than 1.5-12.2. Simon Urbanek, the Cairo maintainer has kindly cleared this situation up for me, and there is now a 1.5-14 which I believe reconciles these two diverged sources, includes the GE v13 changes (see https://github.com/s-u/Cairo/) and fixes my segfual. I assume this will be pushed to CRAN at some point. Thank you very much Paul, Andre and Simon for you help! Mike On Tue, Sep 21, 2021, at 2:24 PM, Paul Murrell wrote: > Hi > > The Cairo_1.5-12.2.tar.gz sources on CRAN contain the changes. It looks > like they have still not been merged back into the main package sources > on R Forge (cc'ing the package maintainer as a gentle reminder). > > I think the Cairo package NEWS file should say 4.1.0 rather than 4.0.0 > > Paul > > On 9/22/2021 9:08 AM, Mike Lee Williams wrote: >> Thanks! AFAICT I am already using the latest version of Cairo, but these >> links gives me a ton of leads to follow up. >> >> One question (which may be better directed at the maintainer of Cairo): >> exactly which version (or commit) of Cairo implements support for the >> new setMask API? >> >> CRAN still points to 1.5-12.2. The NEWS file >> (https://www.rforge.net/Cairo/news.html >> <https://www.rforge.net/Cairo/news.html>) >> refers to changes implemented to support R 4.0.0 in Cairo 1.5-12, but my >> understanding is that setMask was added in R 4.1.0. >> >> I see no mention of changes to support setMask or R 4.1.x in Cairo >> 1.5-13 (not on CRAN yet, but the only release since 1.5-12 according to >> the NEWS file). The 1.5-13 tarball at >> https://www.rforge.net/Cairo/files/ >> <https://www.rforge.net/Cairo/files> >> contains no mention of strings like "setMask", "releasePattern" or >> "setPattern", which seem like they should be in there if that version >> has implemented support for the new API. >> >> Mike >> >> On Tue, Sep 21, 2021, at 1:41 PM, Paul Murrell wrote: >> > 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://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 >> >> <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 >> >> <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> >> >> >> >> >> <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@r-project.org mailing list >> >> > https://stat.ethz.ch/mailman/listinfo/r-devel >> <https://stat.ethz.ch/mailman/listinfo/r-devel> >> >> >> <https://stat.ethz.ch/mailman/listinfo/r-devel >> <https://stat.ethz.ch/mailman/listinfo/r-devel>> >> >> >> >> ______________________________________________ >> >> R-devel@r-project.org mailing list >> >> https://stat.ethz.ch/mailman/listinfo/r-devel >> <https://stat.ethz.ch/mailman/listinfo/r-devel> >> >> >> <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 >> > p...@stat.auckland.ac.nz >> > http://www.stat.auckland.ac.nz/~paul/ >> <http://www.stat.auckland.ac.nz/~paul> > > -- > Dr Paul Murrell > Department of Statistics > The University of Auckland > Private Bag 92019 > Auckland > New Zealand > 64 9 3737599 x85392 > p...@stat.auckland.ac.nz > http://www.stat.auckland.ac.nz/~paul/ ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel