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

Caught segfault error on version 1.0.9 when running in Rmarkdown #500

Open
Mosk915 opened this issue Jul 16, 2024 · 1 comment
Open

Caught segfault error on version 1.0.9 when running in Rmarkdown #500

Mosk915 opened this issue Jul 16, 2024 · 1 comment

Comments

@Mosk915
Copy link

Mosk915 commented Jul 16, 2024

I am on version 1.0.9 of gganimate and getting a segfault error when I try to save an animation via anim_save but only when via Rmarkdown. All packages installed are on their latest CRAN version. When rolling gganimate back to version 1.0.8, there is no issue.

Here is a reproducible example.

---
title: "gganimate"
---

```{r}
library(gganimate)

anim <- ggplot(mtcars, aes(mpg, disp)) +
  transition_states(gear, transition_length = 2, state_length = 1) +
  enter_fade() +
  exit_fade()

anim_save(animation = anim, filename = tempfile(), renderer = magick_renderer())
```

Here is the full error.

*** caught segfault ***
address (nil), cause 'memory not mapped'

Traceback:
1: magick_image_write(image, format, quality, depth, density, comment, compression)
2: magick::image_write(animation, file)
3: `save_animation.magick-image`(animation, filename)
4: save_animation(animation, filename)
5: anim_save(animation = anim, filename = tempfile(), renderer = magick_renderer())
6: eval(expr, envir, enclos)
7: eval(expr, envir, enclos)
8: eval_with_user_handlers(expr, envir, enclos, user_handlers)
9: withVisible(eval_with_user_handlers(expr, envir, enclos, user_handlers))
10: withCallingHandlers(withVisible(eval_with_user_handlers(expr, envir, enclos, user_handlers)), warning = wHandler, error = eHandler, message = mHandler)
11: handle(ev <- withCallingHandlers(withVisible(eval_with_user_handlers(expr, envir, enclos, user_handlers)), warning = wHandler, error = eHandler, message = mHandler))
12: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval_with_user_handlers(expr, envir, enclos, user_handlers)), warning = wHandler, error = eHandler, message = mHandler)))
13: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, debug = debug, last = i == length(out), use_try = stop_on_error != 2L, keep_warning = keep_warning, keep_message = keep_message, log_echo = log_echo, log_warning = log_warning, output_handler = output_handler, include_timing = include_timing)
14: evaluate::evaluate(...)
15: evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning, keep_message = if (is.numeric(options$message)) TRUE else options$message, stop_on_error = if (is.numeric(options$error)) options$error else { if (options$error && options$include) 0L else 2L }, output_handler = knit_handlers(options$render, options))
16: in_dir(input_dir(), expr)
17: in_input_dir(evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning, keep_message = if (is.numeric(options$message)) TRUE else options$message, stop_on_error = if (is.numeric(options$error)) options$error else { if (options$error && options$include) 0L else 2L }, output_handler = knit_handlers(options$render, options)))
18: eng_r(options)
19: block_exec(params)
20: call_block(x)
21: process_group(group)
22: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error = function(e) if (xfun::pkg_available("rlang", "1.0.0")) rlang::entrace(e))
23: xfun:::handle_error(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error = function(e) if (xfun::pkg_available("rlang", "1.0.0")) rlang::entrace(e)), function(loc) { setwd(wd) write_utf8(res, output %n% stdout()) paste0("\nQuitting from lines ", loc) }, if (labels[i] != "") sprintf(" [%s]", labels[i]), get_loc)
24: process_file(text, output)
25: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
26: rmarkdown::render("/home/user/gganimate/gganimate.Rmd", encoding = "UTF-8")
An irrecoverable exception occurred. R is aborting now ...

If it's useful to know, my operating system is Ubuntu 20.04.

@rikudoukarthik
Copy link

I am having almost the same issue with gganimate code on Linux Mint 22. Initially posted it as a Quarto issue, please see that for more details.

I tried rolling gganimate back to 1.0.8 as well as 1.0.7, but neither of them fixed the issue, and I am still getting the same error. I tried both Quarto and RMarkdown, and both of them produce the error. Since the first line of the stack trace mentions an issue with the magick call, I believe the issue has to do with gganimate and not with knitr.

Any thoughts on the solution here would be very useful.

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

2 participants