R Studio Connect: "internal compiler error" for packages

Hi,
I am trying to deploy a Shiny App to RStudio Connect. I have mastered the first hurdles with the kind help of people on here, but now stuck in a different place.
After deploying, the server (I think via packrat) tries to install the dplyr package.

  • installing source package 'dplyr' ...
    10/15 22:20:46.058
    ** package 'dplyr' successfully unpacked and MD5 sums checked
    10/15 22:20:46.058
    ** libs
    [omitting long internals printout]

and fails:

g++: internal compiler error: Killed (program cc1plus)
10/15 22:20:46.058
Please submit a full bug report,
10/15 22:20:46.058
with preprocessed source if appropriate.
10/15 22:20:46.058
See http://bugzilla.redhat.com/bugzilla for instructions.
10/15 22:20:46.058
make: *** [arrange.o] Error 4
10/15 22:20:46.058
make: *** Waiting for unfinished jobs....
10/15 22:20:46.058
ERROR: compilation failed for package 'dplyr'
[logs from the RStudio Connect, not local R Studio]

Googling this specific error suggest that I might be running into hardware issues (memory use) here but I am really unsure, especially as I have no access to the machine itself besides the R Studio Connect instance to check. Therefore, I'd appreciate any help regarding the questions:

  • What causes this error?
  • How can I fix it?
  • Is there a good way to address underlying hardware questions through R?

Thanks a bunch!

Please open a support ticket for this particular question. support@rstudio.com

UPDATE: I fixed this by increasing the swap file, but still appreciate any input re the points below!
Thank you @slopp for your suggestion!
I have investigated this further, and it seems not to be an issue with dplyr, but with my general setup

  1. I deploy my Shiny app
  2. Packrat installs well up to a certain point, then quits with the above error ("compilation fails")
  3. from the internal server error message (make error 4/ top output, it looks like the process runs out of memory

At this point, the deployment reproducibly fails when the deployment tries to install the readr package (which installs just fine when done manually on the server). To fix this, I was wondering

  • the machine has 4 GB RAM. Is that not enough for a standard Shiny app (data input ~ 100MB, plotting dygraphs)? The docs give 4 GB as the minimum reqrd.

  • I figured this was an issue with the number of installs / compiles going on rather than readr as such. Is that a reasonable assumption? I.e. somehow excluding readr from the process would not necessarily fix this?

  • during deployment, the process installs a lot of packages I never directly or indirectly invoke in my scripts (e.g. readr). I assumed these are needed for Shiny and other background operations. Is that true, or am I doing the deployment wrong?

Any suggestions on how to fix are much appreciated -- Thanks for your help!

4GB definitely seems like enough RAM -- we've typically seen errors of this form when trying to install R packages on systems with less that 1GB of RAM. I'm curious as to why that amount of RAM doesn't seem sufficient on your system; are there other processes running that are using up that extra memory? Or perhaps you're requesting parallel compiles, and the launched processes are then competing for memory?

If you can provide more information about the readr installation failure we could try and help. It's possible that it's a transitive dependency of one of your packages, though, and so installation is required by one of the packages you're using. It's hard to say for sure without access to the application you're attempting to deploy, though.