RStudio Server Preview pandoc CPU/memory leak

I'm noticing frequent periods where RStudio essentially freezes when executing commands from the text editor. Watching top, I see rsession consuming gigabytes of memory and 100% cpu. After a while, the rsession name is replaced with pandoc which continues to consume 100% cpu and a constantly growing amount of memory. When I kill pandoc with pkill, the RStudio session becomes active again. I'm using rstudio-server build 1.2.1206.

This was a known issue in windows systems that supposedly was fixed in that particular build (1.2.1206) by changing the pandoc version. You can try updating to the latest daily build and if you still have the same problem, consider filing an issue on github.

Thanks for the advice. I will maybe see if I can change the pandoc version. I'm using Red Hat (CentOS7), by the way and didn't see any pandoc replacements there in the daily builds.

image

image

In the past, we've seen this occur if Pandoc was executed without certain requisite environment variables set, but those cases should be handled now.

Any chance you can provide us with a reproducible example?

I can't provide you a docker image but are there any environment variables you think would be important to look at?

Here are some of the environment variables normally set by RStudio when invoking Pandoc (through rmarkdown):

Not sure if there's something similar going on here?

Do you see a similar kind of hang if you try running Pandoc from the terminal?

/usr/lib/rstudio/bin/pandoc/pandoc --help

Or from R?

system("/usr/lib/rstudio/bin/pandoc/pandoc --help")

(tweak the path to your RStudio / Pandoc installation as appropriate)

Thanks for the info, Kevin.

I discovered that rstudio is using another pandoc on my path coming from some set of system libraries from anaconda. I'm thinking this might be the source of my problem. I suspect libraries from this separate set of system libraries might also be causing R package build failures and intermittently corrupted font rendering in plots besides this CPU/memory leak. I'll post back if removing these from my path resolves this.

I tried working with all 3 versions of pandoc I had installed appearing as system("which pandoc"), and all of them didn't hang. All returned immediately. Unfortunately, I still see the rsession hang followed by pandoc hang. The latter of which I can kill with pkill. So, I'm pretty sure it's not pandoc's problem.

Also, I've polled people around me who are also using this server and only one other person had R hang on them, but I'm not sure it was because of this issue. Could there be something special about my session that could cause this? Could a build up of temporary files cause this?

@wdkrnls Do you have any custom R startup files (e.g. .Rprofile or .Renviron)? If so, does removing those make a difference? Can you think of anything else that might make your session "unique" relative to a baseline R session?

I had no custom .Renviron entries, but have a few lines in my .Rprofile that others don't have. However, I can't imagine that had caused the slowdown. I ended up commenting out my .profile directory and .bashrc and deleting millions of temporary files in my .rstudio/ directory as well as my /tmp directory. While I still observe 100% pandoc freezes at times, the delay subjectively feels greatly lessened.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.