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

error when hosted at shinyapps.io #311

Open
dcaud opened this issue Apr 22, 2021 · 6 comments
Open

error when hosted at shinyapps.io #311

dcaud opened this issue Apr 22, 2021 · 6 comments

Comments

@dcaud
Copy link

@dcaud dcaud commented Apr 22, 2021

I'm getting the error below when trying to write a multi-page pdf using image_write_pdf().

Error in magick_image_map: R: cache resources exhausted `' @ error/cache.c/OpenPixelCache/4083

Here's a code snippet that is likely where the cache is exceeded:

a.series.of.about.15.images %>% image_write(
          tempfile(pattern = "pdftemp", fileext = '.pdf'),
          density = 300,
          format = 'pdf'
        )

This stackoverflow answer suggests that I edit policy.xml, but I can't do that on shinyapps.io.

Is there any way that your magick package for R can be modified to prevent needing to edit policy.xml. I ask because this is the 2nd similar issue I've had and getting Rstudio to change those server files takes weeks...and they may not do it. I'm worried that if I get this error fixed then another will pop up!

Thanks!

@dcaud
Copy link
Author

@dcaud dcaud commented Apr 26, 2021

A little more context:

This error does not appear when I run this on my local Mac or on a linux server with policy xml changed to:

 <policy domain="resource" name="memory" value="4GiB"/>
  <policy domain="resource" name="map" value="6GiB"/>
  <policy domain="resource" name="width" value="116KP"/>
  <policy domain="resource" name="height" value="116KP"/>
  <!-- <policy domain="resource" name="list-length" value="128"/> -->
  <policy domain="resource" name="area" value="1128MB"/>
  <policy domain="resource" name="disk" value="4GiB"/>

@marcjwilliams1
Copy link

@marcjwilliams1 marcjwilliams1 commented Sep 3, 2021

I'm also getting this error when using a docker image. Did anyone find a workaround?

@jhelvy
Copy link

@jhelvy jhelvy commented Apr 25, 2022

Here to say I have the same issue. The problem is exclusive to the app being hosted on shinaapps.io. When I run my app locally, I never have this problem.

@dcaud
Copy link
Author

@dcaud dcaud commented Apr 25, 2022

Likely is a memory problem, @jhelvy. Do you have the 8GB version selected on shinyapps.io? Also, a re-install of the app may be required, b/c shinyapps.io updated the magick policies a few month ago -- those only get applied to re-installed apps, I think.

@marcjwilliams1 Removing the policy.xml file may help. Or increasing the values of the resources.

@jhelvy
Copy link

@jhelvy jhelvy commented Apr 25, 2022

Yes I'm at 8GB. I can re-install to see if that helps.

I made a related post in the RStudio community in case someone there has a solution.

@dcaud
Copy link
Author

@dcaud dcaud commented Apr 25, 2022

For more, see here: rstudio/shinyapps-package-dependencies#320

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