Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault in svglite 1.2.0 #80

Closed
jeroen opened this issue Nov 4, 2016 · 8 comments
Closed

Segfault in svglite 1.2.0 #80

jeroen opened this issue Nov 4, 2016 · 8 comments

Comments

@jeroen
Copy link
Member

jeroen commented Nov 4, 2016

An example in the rsvg package is segfaulting after the svglite update (or perhaps one of it's dependencies). The problem is in svglite; I can reproduce the problem without rsvg as well (on the latest Fedora stable).

The crash appears somewhat randomly which suggests a memory corruption caused earlier on. A reproducible example without rsvg:

options(example.ask=FALSE)
tmp <- tempfile()

# Create svg with basic SG
svg(tmp, width = 10, height = 7)
ggplot2::qplot(mpg, wt, data = mtcars, colour = factor(cyl))
dev.off()

# start svglite devices causes crash
svglite::svglite(tmp, width = 10, height = 7)
## R: fccache.c:545: FcCacheFini: Assertion `fcCacheChains[i] == NULL' failed.
## Aborted

This problem does not appear on mac and windows I think.

@lionel-
Copy link
Member

lionel- commented Nov 4, 2016

judging from the error message, that would be gdtools. I'll look into it.

This problem does not appear on mac and windows I think.

I ran revdep_check() on a mac :/

@jeroen
Copy link
Member Author

jeroen commented Nov 4, 2016

On mac you can test using docker for mac:

docker pull fedora:latest
docker run -i -t fedora:latest /bin/bash

And then install R and svglite, etc.

@lionel-
Copy link
Member

lionel- commented Nov 4, 2016

Could you give the result of gdtools::version_fontconfig() please.

@lionel-
Copy link
Member

lionel- commented Nov 4, 2016

Seems to be the same issue: https://groups.google.com/forum/#!topic/shiny-discuss/5kuGWnEb_LE

@timelyportfolio
Copy link
Contributor

I just checked on Windows 10, and no error. It did hang for a while but eventually worked.

@lionel-
Copy link
Member

lionel- commented Nov 4, 2016

The hang is fontconfig building a cache of the system fonts and should only happen once.

@timelyportfolio
Copy link
Contributor

second try was quick as you suggest. Thanks!

@lionel-
Copy link
Member

lionel- commented Nov 4, 2016

The Cairo svg device initialises fontconfig only once per session:

https://github.com/wch/r-source/blob/7a39bb9cf2d90571209d82f826976d53faf10bf8/src/library/grDevices/src/cairo/cairoFns.c#L678

and doesn't finalise it. Maybe it does not clean up other related resources correctly and this triggers the crash when we try to finalise fontconfig in gdtools. Quick solution: not finalising fontconfig in gdtools to be on the safe side.

lionel- added a commit to lionel-/gdtools that referenced this issue Nov 4, 2016
Fixes r-lib/svglite#80

The R Cairo device also uses Fontconfig and does not finalise it. It's
possible it does not clean up other resources linked to Fontconfig
correctly, which triggers a crash on some platforms when we try to
finalise Fontconfig.
@lionel- lionel- closed this as completed in 172fa40 Nov 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants