Yihui Xie
2017-Feb-20 16:24 UTC
[Rd] Replaying a recorded plot (mixed base and grid) from pdf() in cairo_pdf() crashes R
Hi, I wonder if this is expected or I'm doing a wrong thing. pdf() dev.control('enable') library("grid") plot(1) grid.text("A") res = recordPlot() dev.off() cairo_pdf() replayPlot(res) dev.off() *** caught segfault *** address 0x4, cause 'memory not mapped'> sessionInfo()R version 3.3.2 (2016-10-31) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: macOS Sierra 10.12.3 locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_3.3.2 yaml_2.1.14 Regards, Yihui -- https://yihui.name
Yihui Xie
2017-Feb-20 16:30 UTC
[Rd] Replaying a recorded plot (mixed base and grid) from pdf() in cairo_pdf() crashes R
A quick follow-up: I just used cairo_pdf() as the recording device, and it crashes R as well, so it is probably not relevant to pdf() but an issue specific to cairo_pdf(). cairo_pdf() dev.control('enable') library("grid") plot(1) grid.text("A") res = recordPlot() dev.off() cairo_pdf() replayPlot(res) dev.off() Regards, Yihui -- https://yihui.name On Mon, Feb 20, 2017 at 10:24 AM, Yihui Xie <xie at yihui.name> wrote:> Hi, > > I wonder if this is expected or I'm doing a wrong thing. > > pdf() > dev.control('enable') > > library("grid") > plot(1) > grid.text("A") > > res = recordPlot() > dev.off() > > cairo_pdf() > replayPlot(res) > dev.off() > > > *** caught segfault *** > address 0x4, cause 'memory not mapped' > > >> sessionInfo() > R version 3.3.2 (2016-10-31) > Platform: x86_64-apple-darwin13.4.0 (64-bit) > Running under: macOS Sierra 10.12.3 > > locale: > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > loaded via a namespace (and not attached): > [1] tools_3.3.2 yaml_2.1.14 > > Regards, > Yihui > -- > https://yihui.name
Paul Murrell
2017-Feb-20 18:47 UTC
[Rd] [FORGED] Re: Replaying a recorded plot (mixed base and grid) from pdf() in cairo_pdf() crashes R
Hi I see it too. No, it is not supposed to do that (!). Will take a look. Thanks for reporting! Paul On 21/02/17 05:30, Yihui Xie wrote:> A quick follow-up: I just used cairo_pdf() as the recording device, > and it crashes R as well, so it is probably not relevant to pdf() but > an issue specific to cairo_pdf(). > > cairo_pdf() > dev.control('enable') > > library("grid") > plot(1) > grid.text("A") > > res = recordPlot() > dev.off() > > cairo_pdf() > replayPlot(res) > dev.off() > > > Regards, > Yihui > -- > https://yihui.name > > > On Mon, Feb 20, 2017 at 10:24 AM, Yihui Xie <xie at yihui.name> wrote: >> Hi, >> >> I wonder if this is expected or I'm doing a wrong thing. >> >> pdf() >> dev.control('enable') >> >> library("grid") >> plot(1) >> grid.text("A") >> >> res = recordPlot() >> dev.off() >> >> cairo_pdf() >> replayPlot(res) >> dev.off() >> >> >> *** caught segfault *** >> address 0x4, cause 'memory not mapped' >> >> >>> sessionInfo() >> R version 3.3.2 (2016-10-31) >> Platform: x86_64-apple-darwin13.4.0 (64-bit) >> Running under: macOS Sierra 10.12.3 >> >> locale: >> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 >> >> attached base packages: >> [1] stats graphics grDevices utils datasets methods base >> >> loaded via a namespace (and not attached): >> [1] tools_3.3.2 yaml_2.1.14 >> >> Regards, >> Yihui >> -- >> https://yihui.name > > ______________________________________________ > R-devel at r-project.org mailing list > 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 at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/
Paul Murrell
2017-Feb-20 19:27 UTC
[Rd] [FORGED] Re: Replaying a recorded plot (mixed base and grid) from pdf() in cairo_pdf() crashes R
Hi This appears to be happening (at least) because cairo_pdf() delays initialising a Cairo surface until BM_NewPage(), rather than initiliasing a Cairo surface in BM_Open(), and replayPlot() triggers some activity (set clip region) on the device BEFORE a new page is started (so the pointer to the Cairo surface is null, so BOOM). Not sure yet whether to blame replayPlot() for not starting with a new page operation OR to blame cairo_pdf() for not initialising a Cairo surface at device startup. If anyone who knows more about Cairo (or cairo_pdf()) wants to point out a good reason for the way cairo_pdf() currently works, please don't hold back. Paul On 21/02/17 05:30, Yihui Xie wrote:> A quick follow-up: I just used cairo_pdf() as the recording device, > and it crashes R as well, so it is probably not relevant to pdf() but > an issue specific to cairo_pdf(). > > cairo_pdf() > dev.control('enable') > > library("grid") > plot(1) > grid.text("A") > > res = recordPlot() > dev.off() > > cairo_pdf() > replayPlot(res) > dev.off() > > > Regards, > Yihui > -- > https://yihui.name > > > On Mon, Feb 20, 2017 at 10:24 AM, Yihui Xie <xie at yihui.name> wrote: >> Hi, >> >> I wonder if this is expected or I'm doing a wrong thing. >> >> pdf() >> dev.control('enable') >> >> library("grid") >> plot(1) >> grid.text("A") >> >> res = recordPlot() >> dev.off() >> >> cairo_pdf() >> replayPlot(res) >> dev.off() >> >> >> *** caught segfault *** >> address 0x4, cause 'memory not mapped' >> >> >>> sessionInfo() >> R version 3.3.2 (2016-10-31) >> Platform: x86_64-apple-darwin13.4.0 (64-bit) >> Running under: macOS Sierra 10.12.3 >> >> locale: >> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 >> >> attached base packages: >> [1] stats graphics grDevices utils datasets methods base >> >> loaded via a namespace (and not attached): >> [1] tools_3.3.2 yaml_2.1.14 >> >> Regards, >> Yihui >> -- >> https://yihui.name > > ______________________________________________ > R-devel at r-project.org mailing list > 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 at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/
Reasonably Related Threads
- [FORGED] Re: Replaying a recorded plot (mixed base and grid) from pdf() in cairo_pdf() crashes R
- [FORGED] Re: Replaying a recorded plot (mixed base and grid) from pdf() in cairo_pdf() crashes R
- recordPlot() on non-interactive graphics device?
- recordPlot/replayPlot not working with saveRDS/readRDS
- Request to Replace Recordplot ,, replayplot