I have a shiny server running (1.3.0.403) on Red Hat Enterprise Linux Server release 6.5 (Santiago) running in a VM.
Some apps fail on startup with the notes that "The application failed to start. The application took too long to respond." Rebooting the shiny server allows the apps to work fine until the problem occurs again (within a day).
Others apps are fine. The sample apps work without issue.
We have a few different directories with different apps. For example,
├── shiny-server │ ├── apps │ ├── sample-apps │ └── tutorials
The peculiar thing is that the app path seem to be the issue. For example, if I copy sample-apps/hello
to apps/hello
I get the same timeout issue with the same app code (whereas it works in the original path).
I've seen this post but the sample apps are very lightweight and speeding up the startup of your app doesn't seem like the solution.
Thanks,
Max
This happened to me a few times. You need to increase the time for the app to initialize by setting the timeout to something like (app_init_timeout 300;
) if you want to give it 5 mins (300 secs) in your shiny-server.conf
file. The documentation is located here.
Here is an example /etc/shiny-server/shiny-server.conf
:
# Tell Shiny Server that we want to run as the user whose
# home directory we find the application in.
run_as :HOME_USER:;
app_init_timeout 300;
app_idle_timeout 300;
# Define a server that listens of port 3838.
server {
listen 3838;
# Define a location at the base URL
location / {
# Allow users to host their own apps in ~/ShinyApps
user_dirs;
# Optionally, you can restrict the privilege of hosting Shiny applications
# only to members of a particular Linux group.
# members_of shinyUsers;
}
}
Following this comment, I speed up the startup of my app by saving/loading the data as an .RData
file:
# Save everything in an R Workspace
save.image(file="shiny.RData")
# Load (e.g. in global.R)
load("/PATH/TO/shiny.RData")
[If you don't want/need to save an entire R Workspace, can use save( object1, object2, ..., file="shiny.RData")
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With