Bookdown: memory issues upon compilation

Hi,

I seem to have memory issues with the compilation of a bookdown. My book compiles fine if I only include half of my Rmd files. If I include all of them, I get the following message.

Error: pandoc document conversion failed with error 9

A stackoverflow poster provided a way to use pandoc_args to increase stack size when processing a single markdown file (https://stackoverflow.com/questions/25599860/how-to-increase-stack-space-overflow-for-pandoc-in-r)

    pandoc_args: [
      "+RTS", "-K64m",
      "-RTS"
    ]

What is the proper way to implement this in bookdown?

When I include the pandoc_args in the _output.yml file. The following pandoc command is issued (see the presence of 2 sets of +RTS -Ksize -RTS):

/usr/bin/pandoc +RTS -K512m -RTS _main.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output _main.html --email-obfuscation none --wrap preserve +RTS -K1024m -RTS --standalone --section-divs --table-of-contents --toc-depth 3 --template /usr/lib64/R/library/bookdown/templates/gitbook.html --highlight-style pygments --number-sections --css css/style.css --include-in-header /tmp/RtmpXh83fq/rmarkdown-str1a95fb43246.html --mathjax --filter /usr/bin/pandoc-citeproc
Error: pandoc document conversion failed with error 9
Please delete _main.Rmd after you finish debugging the error.

> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS: /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] bookdown_0.7

loaded via a namespace (and not attached):
 [1] compiler_3.4.3  backports_1.1.2 magrittr_1.5    rprojroot_1.3-2
 [5] htmltools_0.3.6 tools_3.4.3     rstudioapi_0.7  yaml_2.1.18
 [9] Rcpp_0.12.16    stringi_1.1.7   rmarkdown_1.9   knitr_1.20
[13] stringr_1.3.0   digest_0.6.15   xfun_0.3        evaluate_0.10.1

Hello,

just a wild guess to be sure.

When you had the error the first time, did you delete _main.Rmd afterward that I believe is created by bookdown during compilation of the book ?

It could cause issue in following try. Just to be sure.

Hi

_main.Rmd is not deleted if a compilation try fails. This is the consequence not the cause of the error 9 message I get.
I issue a "system('rm -f _main.Rmd')" call before every compilation attempt.

Still don't know what the error 9 was all about. But, we solved the compilation problem by using a beefier server and using a more recent version of pandoc (CentOS repo only included an antique version of pandoc).

2 Likes

hi,how to solve the problem in bookdown?