I have an app that I've uploaded to shinyapps.io, and I've been noticing some instability that I can't trace. The app has a bunch of different reactive inputs which call code to filter, calculate, and plot some data. Occasionally, a certain sequence of selecting these inputs causes the site to freeze and trigger a 500 Internal Server Error.
Strangely enough, when I execute the same commands on a locally-hosted (thru R) version of the app, I don't get an error.
It's a really booger to trace: any suggestions on what may be causing the problem and/or how to debug it better? I'm a javascript novice, so any help would be appreciated.
Full representative error log:
/opt/shiny-server/scripts/shiny-run: line 3: 32 Killed
/bin/bash --login -c "$SHINY_EXEC_COMMAND $SHINY_R_PATH $*"
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
<<[email protected]>>/shared/bootstrap/css/bootstrap-responsive.min.css
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
<<[email protected]>>/shared/bootstrap/css/bootstrap.min.css
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
<<[email protected]>>/shared/font-awesome/css/font-awesome.min.css
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
<<[email protected]>>/shared/datatables/css/DT_bootstrap.css
Alright-- it turns out the problem is actually very simple. The app was simply running out of memory.
In the error log, there was a line about processes being killed, which is indicative of not enough memory. You can access the error log with ShinyApps::showLogs()
To fix the problem, you can bump up the memory available to the app with: shinyapps::configureApp("APPNAME", size="xlarge")
where "APPNAME" is the name of the app. More info about memory is here: http://shiny.rstudio.com/articles/shinyapps.html
Thanks to the folks at RStudio for helping diagnose.